;ς ³Α§Fc@svdZdZdkZdkZdkZdkZgZhZd„Zd„Z d„Z d„Z d„Z d„Z dS( sΔ Holds a series of utility functions for cataloguing, retrieving, and manipulating callback functions and chains. Refer to the documentation for which callbacks are available and their behavior. s$Revision: 1012 $NcCsŸt|ƒ}gi}|D]$}|idƒo||ƒqq~}xQ|D]I}t||ƒ}|d}t |ƒot i |gƒi|ƒqNqNWdS(sθ Goes through the plugin's contents and catalogues all the functions that start with cb_. Functions that start with cb_ are callbacks. @param plugin_module: the module to catalogue @type plugin_module: module scb_iN(sdirs plugin_moduleslistingsappends_[1]sitems startswithsmemsgetattrsfuncsmemadjscallables callbackss setdefault(s plugin_modulesmemadjsmems_[1]sitemsfuncslisting((s./Pyblosxom/plugin_utils.pyscatalogue_plugin#s ;  cCsti|gƒSdS(sΊ Returns a list of functions registered with the callback. @returns: list of functions registered with the callback (or an empty list) @rtype: list of functions N(s callbackssgetschain(schain((s./Pyblosxom/plugin_utils.pysget_callback_chain5scCsΥtodSntiƒxE|D]=}tii|ƒotii |ƒq t d|ƒ‚q Wt ||ƒ}x^|D]V}t |ƒ}x*|idƒdD]}t||ƒ}qWt|ƒti |ƒqwWdS(sœ Imports and initializes plugins from the directories in the list specified by "plugins_dir". If no such list exists, then we don't load any plugins. If the user specifies a "load_plugins" list of plugins to load, then we explicitly load those plugins in the order they're listed. If the load_plugins key does not exist, then we load all the plugins in the plugins directory using an alphanumeric sorting order. NOTE: If PyBlosxom is part of a long-running process, you must restart PyBlosxom in order to pick up any changes to your plugins. @param plugin_dirs: the list of directories to add to the sys.path because that's where our plugins are located. @type plugin_dirs: list of strings @param plugin_list: the list of plugins to load, or if None, we'll load all the plugins we find in those dirs. @type plugin_list: list of strings or None NsEPlugin directory '%s' does not exist. Please check your config file.s.i(spluginss callbackssclears plugin_dirssmemsosspathsisdirssyssappends Exceptionsget_plugin_lists plugin_lists __import__s_modulessplitscompsgetattrscatalogue_plugin(s plugin_dirss plugin_lists_modulesmemscomp((s./Pyblosxom/plugin_utils.pysinitialize_plugins?s$   cCs<to-x*tD]}|i|jo|SqqWntSdS(s This retrieves a plugin instance (it's a Python module instance) by name. @param name: the name of the plugin to retrieve (ex: "xmlrpc") @type name: string @returns: the Python module instance for the plugin or None @rtype: Python module N(spluginssmems__name__snamesNone(snamesmem((s./Pyblosxom/plugin_utils.pysget_plugin_by_namels cCs(tiitii|ƒdƒdSdS(s9 Takes a filename and returns the module name from the filename. Example: passing in "/blah/blah/blah/module.ext" returns "module" @param filename: the filename in question (with a full path) @type filename: string @returns: the filename without path or extension @rtype: string iiN(sosspathssplitextssplitsfilename(sfilename((s./Pyblosxom/plugin_utils.pysget_module_name}s cCsΛ|tjoΆg}xŸ|D]—}titii|dƒƒ}gi }|D]}|t |ƒƒqL~}gi }|D]%}|idƒ o||ƒqyqy~}||7}qW|iƒn|SdS(s# This handles the situation where the user has provided a series of plugin dirs, but has not specified which plugins they want to load from those dirs. In this case, we load all possible plugins except the ones whose names being with _ . @param plugin_list: List of plugins to load @type plugin_list: list or None @param plugin_dirs: A list of directories where plugins can be loaded from @type plugin_dirs: list @return: list of python module names of the plugins to load @rtype: list of strings s*.pys_N(s plugin_listsNones plugin_dirssmemsglobsosspathsjoins file_listsappends_[1]sfilenamesget_module_namesplugins startswithssort(s plugin_lists plugin_dirsspluginsmems_[1]s file_listsfilename((s./Pyblosxom/plugin_utils.pysget_plugin_list‹s -<(s__doc__s __revision__sossglobssyssos.pathspluginss callbacksscatalogue_pluginsget_callback_chainsinitialize_pluginssget_plugin_by_namesget_module_namesget_plugin_list( sinitialize_pluginss __revision__sget_plugin_listscatalogue_pluginsglobsget_callback_chainssyss callbackssget_module_namespluginssget_plugin_by_namesos((s./Pyblosxom/plugin_utils.pys?s      -