Package gluon :: Module fileutils
[hide private]
[frames] | no frames]

Module fileutils

source code


| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

File operations
---------------

Functions [hide private]
 
parse_semantic(version='Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26')
Parses a version string according to http://semver.org/ rules
source code
 
parse_legacy(version='Version 1.99.0 (2011-09-19 08:23:26)')
Parses "legacy" version string
source code
 
parse_version(version)
Attempts to parse SemVer, fallbacks on legacy
source code
 
read_file(filename, mode='r')
Returns content from filename, making sure to close the file explicitly on exit.
source code
 
write_file(filename, value, mode='w')
Writes <value> to filename, making sure to close the file explicitly on exit.
source code
 
readlines_file(filename, mode='r')
Applies .split(' ') to the output of `read_file()`
source code
 
mktree(path) source code
 
listdir(path, expression='^.+$', drop=True, add_dirs=False, sort=True, maxnum=None)
Like `os.listdir()` but you can specify a regex pattern to filter files.
source code
 
recursive_unlink(f)
Deletes `f`.
source code
 
cleanpath(path)
Turns any expression/path into a valid filename.
source code
 
_extractall(filename, path='.', members=None) source code
 
tar(file, dir, expression='^.+$', filenames=None)
Tars dir into file, only tars file that match expression
source code
 
untar(file, dir)
Untar file into dir
source code
 
w2p_pack(filename, path, compiled=False, filenames=None)
Packs a web2py application.
source code
 
create_welcome_w2p() source code
 
w2p_unpack(filename, path, delete_tar=True) source code
 
w2p_pack_plugin(filename, path, plugin_name)
Packs the given plugin into a w2p file.
source code
 
w2p_unpack_plugin(filename, path, delete_tar=True) source code
 
tar_compiled(file, dir, expression='^.+$')
Used to tar a compiled application.
source code
 
up(path) source code
 
get_session(request, other_application='admin')
Checks that user is authorized to access other_application
source code
 
set_session(request, session, other_application='admin')
Checks that user is authorized to access other_application
source code
 
check_credentials(request, other_application='admin', expiration=3600, gae_login=True)
Checks that user is authorized to access other_application
source code
 
fix_newlines(path) source code
 
copystream(src, dest, size, chunk_size=100000)
this is here because I think there is a bug in shutil.copyfileobj
source code
 
make_fake_file_like_object() source code
 
abspath(*relpath, **base)
Converts relative path to absolute path based (by default) on applications_parent
source code
Variables [hide private]
  __package__ = 'gluon'
Function Details [hide private]

parse_semantic(version='Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26')

source code 
Parses a version string according to http://semver.org/ rules

Args:
    version(str): the SemVer string

Returns:
    tuple: Major, Minor, Patch, Release, Build Date

parse_legacy(version='Version 1.99.0 (2011-09-19 08:23:26)')

source code 
Parses "legacy" version string

Args:
    version(str): the version string

Returns:
    tuple: Major, Minor, Patch, Release, Build Date

listdir(path, expression='^.+$', drop=True, add_dirs=False, sort=True, maxnum=None)

source code 

Like `os.listdir()` but you can specify a regex pattern to filter files. If `add_dirs` is True, the returned items will have the full path.

recursive_unlink(f)

source code 

Deletes `f`. If it's a folder, also its contents will be deleted

cleanpath(path)

source code 

Turns any expression/path into a valid filename. replaces / with _ and removes special characters.

w2p_pack(filename, path, compiled=False, filenames=None)

source code 
Packs a web2py application.

Args:
    filename(str): path to the resulting archive
    path(str): path to the application
    compiled(bool): if `True` packs the compiled version
    filenames(list): adds filenames to the archive

w2p_pack_plugin(filename, path, plugin_name)

source code 

Packs the given plugin into a w2p file. Will match files at:

   <path>/*/plugin_[name].*
   <path>/*/plugin_[name]/*

tar_compiled(file, dir, expression='^.+$')

source code 

Used to tar a compiled application. The content of models, views, controllers is not stored in the tar file.