Home | Trees | Index | Help |
|
---|
Package Pyblosxom :: Module tools |
|
Tools module
The swiss army knife for all things pyblosxomClasses | |
---|---|
LogFilter |
Filters out messages from log-channels that are not listed in the log_filter config variable. |
Replacer |
Class for replacing variables in a template |
Stripper |
Strips HTML |
VariableDict |
Wraps around a standard dict allowing for escaped and urlencoding of internal data by tacking on a "_urlencoded" or a "_escaped" to the end of the key name. |
Function Summary | |
---|---|
Cleanup the tools module. | |
escape_text(s)
| |
tuple of 9 ints |
Returns the filestat on a given file. |
string |
Generate a random string |
Pyblosxom.cache.base.BlosxomCacheBase
subclass
|
Retrieves the cache from the request or fetches a new CacheDriver instance. |
logging.Logger for Python >=2.3, Pyblosxom._logging.Logger for
Python <2.3
|
Creates and retuns a log channel. |
object |
Module importer |
Initialize the tools module. | |
boolean |
Checks s to see if it's likely to be a year or not. |
lock(f,
flags)
| |
Logs some info about the calling function/method. | |
Logs an exception to the given file. | |
string |
This method parses the open file object passed, replacing any keys found using the replacement dictionary passed. |
Takes a url and a querystring and renders the page that corresponds with that by creating a Request and a PyBlosxom object and passing it through. | |
dict |
Executes a callback chain on a given piece of data. |
unlock(f)
| |
This is a utility function that allows plugins to easily update statically rendered entries without going through all the rigamarole. | |
urlencode_text(s)
| |
list |
This function walks a directory tree starting at a specified root folder, and returns a list of all of the files (and optionally folders) that match our pattern(s). |
string |
Takes in a filepath and a list of extensions and tries them all until it finds the first extension that works. |
Variable Summary | |
---|---|
str |
__revision__ = '$Id: tools.py,v 1.50 2005/12/09 05:09:11...
|
dict |
month2num : A dict of literal months to its number format |
list |
MONTHS : A list of valid literal and numeral months |
dict |
num2month : A dict of number month format to its literal format |
SRE_Pattern |
VAR_REGEXP : Regular expression for detection and substituion of variables |
Function Details |
---|
cleanup()Cleanup the tools module. This should be called from Pyblosxom.pyblosxom.PyBlosxom.cleanup. |
filestat(request, filename)Returns the filestat on a given file. We store the filestat in case we've already retrieved it this time.
|
generateRandStr(minlen=5, maxlen=10)Generate a random string Tool to generate a random string betweenminlen to
maxlen characters
|
get_cache(request)Retrieves the cache from the request or fetches a new CacheDriver instance.
|
getLogger(log_file=None)Creates and retuns a log channel. If no log_file is given the system-wide logfile as defined in config.py is used. If a log_file is given that's where the created logger logs to.
|
importName(modulename, name)Module importer For modules that can only be determined during runtime
|
initialize(config)Initialize the tools module. This gives the module a chance to use configuration from the pyblosxom config.py file. This should be called from Pyblosxom.pyblosxom.PyBlosxom.initialize. |
is_year(s)Checks s to see if it's likely to be a year or not. In order to be considered to be a year, it must pass the following criteria:
|
log_caller(frame_num=1, log_file=None)Logs some info about the calling function/method. Usefull for debugging. Usage: import tools tools.log_caller() # logs frame 1 tools.log_caller(2) tools.log_caller(3, log_file="/path/to/file") @param frame_num: optional, index of the frame @type frame_num: C{int} @param log_file: optional, the file to log to @type log_file: C{str} |
log_exception(log_file=None)Logs an exception to the given file. Uses the system-wide log_file as defined in config.py if none is given here.
|
parse(request, encoding, var_dict, template)This method parses the open file object passed, replacing any keys found using the replacement dictionary passed. Uses theReplacer object. From OPAGCGI library
|
render_url(cdict, pathinfo, querystring='')Takes a url and a querystring and renders the page that corresponds with that by creating a Request and a PyBlosxom object and passing it through.
|
run_callback(chain, input, mappingfunc=<function <lambda> at 0x40268ed4>, donefunc=<function <lambda> at 0x40268f0c>, defaultfunc=None)Executes a callback chain on a given piece of data. passed in is a dict of name/value pairs. Consult the documentation for the specific callback chain you're executing. Callback chains should conform to their documented behavior. This function allows us to do transforms on data, handling data, and also callbacks. The difference in behavior is affected by the mappingfunc passed in which converts the output of a given function in the chain to the input for the next function. If this is confusing, read through the code for this function.
|
update_static_entry(cdict, entry_filename)This is a utility function that allows plugins to easily update statically rendered entries without going through all the rigamarole. First we figure out whether this blog is set up for static rendering. If not, then we return--no harm done. If we are, then we call render_url for each static_flavour of the entry and then for each static_flavour of the index page.
|
Walk(request, root='.', recurse=0, pattern='', return_folders=0)This function walks a directory tree starting at a specified root folder, and returns a list of all of the files (and optionally folders) that match our pattern(s). Taken from the online Python Cookbook and modified to own needs. It will look at the config "ignore_directories" for a list of directories to ignore. It uses a regexp that joins all the things you list. So the following:config.py["ignore_directories"] = ["CVS", "dev/pyblosxom"]turns into the regexp: .*?(CVS|dev/pyblosxom)$It will also skip all directories that start with a period.
|
what_ext(extensions, filepath)Takes in a filepath and a list of extensions and tries them all until it finds the first extension that works.
|
Variable Details |
---|
__revision__
|
month2numA dict of literal months to its number format
|
MONTHSA list of valid literal and numeral months
|
num2monthA dict of number month format to its literal format
|
VAR_REGEXPRegular expression for detection and substituion of variables
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Tue Feb 7 21:43:58 2006 | http://epydoc.sf.net |