PK j60paste/__init__.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: # don't prevent use of paste if pkg_resources isn't installed from pkgutil import extend_path __path__ = extend_path(__path__, __name__) import modulefinder for p in __path__: modulefinder.AddPackagePath(__name__, p) PK.68/2Ppaste/__init__.pyo; IFc@szydkZeieWn/ej o#dklZeeeZnXdkZxeD]Zei eeq\WdS(N(s extend_path( s pkg_resourcessdeclare_namespaces__name__s ImportErrorspkgutils extend_paths__path__s modulefinderspsAddPackagePath(s extend_paths modulefinders pkg_resourcessps__path__((s2build/bdist.darwin-8.0.1-x86/egg/paste/__init__.pys?s   PK.68/2Ppaste/__init__.pyc; IFc@szydkZeieWn/ej o#dklZeeeZnXdkZxeD]Zei eeq\WdS(N(s extend_path( s pkg_resourcessdeclare_namespaces__name__s ImportErrorspkgutils extend_paths__path__s modulefinderspsAddPackagePath(s extend_paths modulefinders pkg_resourcessps__path__((s2build/bdist.darwin-8.0.1-x86/egg/paste/__init__.pys?s   PK.68&i paste/deploy/epdesc.pyo; IFc@sdefdYZdefdYZdefdYZdefdYZdefd YZd efd YZd S( sAppFactoryDescriptioncBstZdZRS(NsA This gives a factory/function that can create WSGI apps (s__name__s __module__s description(((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/epdesc.pysAppFactoryDescriptionssCompositeFactoryDescriptioncBstZdZRS(Ns This gives a factory/function that can create WSGI apps, and has access to the application creator so that it can in turn fetch apps based on name. (s__name__s __module__s description(((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/epdesc.pysCompositeFactoryDescriptionssFilterAppFactoryDescriptioncBstZdZRS(Ns This gives a factory/function that wraps a WSGI application to create another WSGI application (typically applying middleware) (s__name__s __module__s description(((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/epdesc.pysFilterAppFactoryDescription ssFilterFactoryDescriptioncBstZdZRS(Ns This gives a factory/function that return a function that can wrap a WSGI application and returns another WSGI application. paste.filter_app_factory is the same thing with less layers. (s__name__s __module__s description(((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/epdesc.pysFilterFactoryDescriptionssServerFactoryDescriptioncBstZdZRS(Ns This gives a factory/function that creates a server, that can be called with a WSGI application to run indefinitely. paste.server_runner is the same thing with less layers. (s__name__s __module__s description(((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/epdesc.pysServerFactoryDescriptionssServerRunnerDescriptioncBstZdZRS(Ns This gives a factory/function that, given a WSGI application and configuration, will serve the application indefinitely. (s__name__s __module__s description(((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/epdesc.pysServerRunnerDescription!sN(sobjectsAppFactoryDescriptionsCompositeFactoryDescriptionsFilterAppFactoryDescriptionsFilterFactoryDescriptionsServerFactoryDescriptionsServerRunnerDescription(sServerRunnerDescriptionsServerFactoryDescriptionsFilterFactoryDescriptionsCompositeFactoryDescriptionsAppFactoryDescriptionsFilterAppFactoryDescription((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/epdesc.pys?s PK j6j>Qbbpaste/deploy/__init__.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php from loadwsgi import * try: from config import CONFIG except ImportError: # @@: Or should we require Paste? Or should we put threadlocal # into this package too? pass PK.689MI3I3paste/deploy/config.pyc; IFc@sdZdkZdkZeaeaddddgZdZdefdYZ e Z defdYZ d Z e iZ defd YZd eeed Zeie_dS( s*Paste Configuration Middleware and ObjectsNsDispatchingConfigsCONFIGsConfigMiddlewaresPrefixMiddlewarecCsoy tiSWn]tj o.dklataht_}|Sn%tj oht_}|SnXdS(N(slocal(s config_locals wsgi_dicts NameErrors paste.deploy.util.threadinglocalslocalsresultsAttributeError(sresult((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys local_dict s     cBstZdZeiZdZdZedZ dZ dZ edZ dZ dZd Zd Zd ZRS( s This is a configuration object that can be used globally, imported, have references held onto. The configuration may differ by thread (or may not). Specific configurations are registered (and deregistered) either for the process or for threads. cCs|iizWd|_xGno?d|i|_ti|i oPn|id7_q#WWd|iiXg|_dS(Niispaste.processconfig_%i( sselfs_constructor_locksacquiresdispatching_ids _local_keys local_dictshas_keysreleases_process_configs(sself((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys__init__*s  cCs#ti|igi|dS(s Make ``conf`` the active configuration for this thread. Thread-local configuration always overrides process-wide configuration. This should be used like:: conf = make_conf() dispatching_config.push_thread_config(conf) try: ... do stuff ... finally: dispatching_config.pop_thread_config(conf) N(s local_dicts setdefaultsselfs _local_keysappendsconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspush_thread_config7scCs|it|i|dS(s Remove a thread-local configuration. If ``conf`` is given, it is checked against the popped configuration and an error is emitted if they don't match. N(sselfs _pop_froms local_dicts _local_keysconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspop_thread_configHscCsD|i}|tj o ||j otd||fndS(NsBThe config popped (%s) is not the same as the config expected (%s)(slstspopspoppedsconfsNonesAssertionError(sselfslstsconfspopped((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys _pop_fromPs cCs|ii|dS(sg Like push_thread_config, but applies the configuration to the entire process. N(sselfs_process_configssappendsconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspush_process_configXscCs|i|i|dS(N(sselfs _pop_froms_process_configssconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspop_process_config_scCs:|i}|tjotdnt||SdS(Ns?No configuration has been registered for this process or thread(sselfs current_confsconfsNonesAttributeErrorsgetattrsattr(sselfsattrsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys __getattr__bs  cCsIti|i}|o |dSn|io|idSntSdS(Ni(s local_dictsgetsselfs _local_keysthread_configss_process_configssNone(sselfsthread_configs((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys current_confjs   cCs5|i}|tjotdn||SdS(Ns?No configuration has been registered for this process or thread(sselfs current_confsconfsNones TypeErrorskey(sselfskeysconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys __getitem__ss  cCs|i|SdS(N(sselfshas_keyskey(sselfskey((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys __contains__|scCs|i}|||`_: Python Web Server Gateway Interface v1.0 cCsdS(s Calls ``start_response(status_code, header_list)`` and returns an iterator for the body of the response. N((senvironsstart_response((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys__call__s(s__name__s __module__s__doc__s__call__(((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pysIWSGIApps sIFiltercBstZdZdZRS(sr A filter is a simple case of middleware, where an object wraps a single WSGI application (IWSGIApp). cCsdS(sj Returns an IWSGIApp object, typically one that wraps the ``wsgi_app`` passed in. N((swsgi_app((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys__call__s(s__name__s __module__s__doc__s__call__(((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pysIFilters sIServercBstZdZdZRS(s$ A simple server interface. cCsdS(s Serves the given WSGI application. May serve once, many times, forever; nothing about how the server works is specified here. N((swsgi_app((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys__call__s(s__name__s __module__s__doc__s__call__(((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pysIServers N(sNonesloadapps loadfilters loadserversobjectsIPasteAppFactorysIPasteCompositFactorysIPasteFilterFactorysIPasteFilterAppFactorysIPasteServerFactorysIPasteServerRunnersILoadersIWSGIAppsIFiltersIServer( s loadfiltersIFiltersIWSGIAppsIServersIPasteFilterFactorysIPasteServerRunnersIPasteServerFactorysIPasteCompositFactorysloadappsILoadersIPasteAppFactorysIPasteFilterAppFactorys loadserver((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys?s     PK.68I%  !paste/deploy/paster_templates.pyc; IFc@s0dkZdklZdefdYZdS(N(sTemplates PasteDeploycBs/tZdZdZdgZdgZdZRS(Nspaster_templates/paste_deploys/A web application deployed through paste.deploys PasteDeploysPasteScript#basic_packagecCsx=dgD]2}|itii|ddd|dtq W|itii|ddd|dt |i o dd GHd GHd GHdd GHndS( Ns PasteDeployssetup.pysExtra requirementss%r, sindents Entry pointssD [paste.app_factory] main = %(package)s.wsgiapp:make_app s*iHsH* Run "paster serve docs/devel_config.ini" to run the sample applications* on http://localhost:8080( sprereqscommandsinsert_into_filesosspathsjoins output_dirsTruesvarssFalsesverbose(sselfscommands output_dirsvarssprereq((sAbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/paster_templates.pysposts    (s__name__s __module__s _template_dirssummarys egg_pluginssrequired_templatesspost(((sAbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/paster_templates.pys PasteDeploys   (sosspaste.script.templatessTemplates PasteDeploy(s PasteDeploysossTemplate((sAbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/paster_templates.pys?s  PK j6 __paste/deploy/converters.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php def asbool(obj): if isinstance(obj, (str, unicode)): obj = obj.strip().lower() if obj in ['true', 'yes', 'on', 'y', 't', '1']: return True elif obj in ['false', 'no', 'off', 'n', 'f', '0']: return False else: raise ValueError( "String is not true/false: %r" % obj) return bool(obj) def aslist(obj, sep=None, strip=True): if isinstance(obj, (str, unicode)): lst = obj.split(sep) if strip: lst = [v.strip() for v in lst] return lst elif isinstance(obj, (list, tuple)): return obj elif obj is None: return [] else: return [obj] PK.68mDpaste/deploy/__init__.pyo; IFc@s2dkTydklZWnej onXdS((s*(sCONFIGN(sloadwsgisconfigsCONFIGs ImportError(sCONFIG((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/__init__.pys?sPK j6] paste/deploy/paster_templates.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php import os from paste.script.templates import Template class PasteDeploy(Template): _template_dir = 'paster_templates/paste_deploy' summary = "A web application deployed through paste.deploy" egg_plugins = ['PasteDeploy'] required_templates = ['PasteScript#basic_package'] def post(self, command, output_dir, vars): for prereq in ['PasteDeploy']: command.insert_into_file( os.path.join(output_dir, 'setup.py'), 'Extra requirements', '%r,\n' % prereq, indent=True) command.insert_into_file( os.path.join(output_dir, 'setup.py'), 'Entry points', (' [paste.app_factory]\n' ' main = %(package)s.wsgiapp:make_app\n') % vars, indent=False) if command.verbose: print '*'*72 print '* Run "paster serve docs/devel_config.ini" to run the sample application' print '* on http://localhost:8080' print '*'*72 PK j6XXpaste/deploy/loadwsgi.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php import os import re import sys import urllib from ConfigParser import ConfigParser import pkg_resources from paste.deploy.util.fixtypeerror import fix_call __all__ = ['loadapp', 'loadserver', 'loadfilter', 'appconfig'] ############################################################ ## Utility functions ############################################################ def import_string(s): return pkg_resources.EntryPoint.parse("x="+s).load(False) def _aslist(obj): """ Turn object into a list; lists and tuples are left as-is, None becomes [], and everything else turns into a one-element list. """ if obj is None: return [] elif isinstance(obj, (list, tuple)): return obj else: return [obj] def _flatten(lst): """ Flatten a nested list. """ if not isinstance(lst, (list, tuple)): return [lst] result = [] for item in lst: result.extend(_flatten(item)) return result class NicerConfigParser(ConfigParser): def __init__(self, filename, *args, **kw): ConfigParser.__init__(self, *args, **kw) self.filename = filename def _interpolate(self, section, option, rawval, vars): try: return ConfigParser._interpolate( self, section, option, rawval, vars) except Exception, e: args = list(e.args) args[0] = 'Error in file %s, [%s] %s=%r: %s' % ( self.filename, section, option, rawval, e) e.args = tuple(args) raise ############################################################ ## Object types ############################################################ class _ObjectType(object): name = None egg_protocols = None config_prefixes = None def __init__(self): # Normalize these variables: self.egg_protocols = map(_aslist, _aslist(self.egg_protocols)) self.config_prefixes = map(_aslist, _aslist(self.config_prefixes)) def __repr__(self): return '<%s protocols=%r prefixes=%r>' % ( self.name, self.egg_protocols, self.config_prefixes) def invoke(self, context): assert context.protocol in _flatten(self.egg_protocols) return fix_call(context.object, context.global_conf, **context.local_conf) class _App(_ObjectType): name = 'application' egg_protocols = ['paste.app_factory', 'paste.composite_factory', 'paste.composit_factory'] config_prefixes = [['app', 'application'], ['composite', 'composit'], 'pipeline', 'filter-app'] def invoke(self, context): if context.protocol in ('paste.composit_factory', 'paste.composite_factory'): return fix_call(context.object, context.loader, context.global_conf, **context.local_conf) elif context.protocol == 'paste.app_factory': return fix_call(context.object, context.global_conf, **context.local_conf) else: assert 0, "Protocol %r unknown" % context.protocol APP = _App() class _Filter(_ObjectType): name = 'filter' egg_protocols = [['paste.filter_factory', 'paste.filter_app_factory']] config_prefixes = ['filter'] def invoke(self, context): if context.protocol == 'paste.filter_factory': return fix_call(context.object, context.global_conf, **context.local_conf) elif context.protocol == 'paste.filter_app_factory': def filter_wrapper(wsgi_app): # This should be an object, so it has a nicer __repr__ return fix_call(context.object, wsgi_app, context.global_conf, **context.local_conf) return filter_wrapper else: assert 0, "Protocol %r unknown" % context.protocol FILTER = _Filter() class _Server(_ObjectType): name = 'server' egg_protocols = [['paste.server_factory', 'paste.server_runner']] config_prefixes = ['server'] def invoke(self, context): if context.protocol == 'paste.server_factory': return fix_call(context.object, context.global_conf, **context.local_conf) elif context.protocol == 'paste.server_runner': def server_wrapper(wsgi_app): # This should be an object, so it has a nicer __repr__ return fix_call(context.object, wsgi_app, context.global_conf, **context.local_conf) return server_wrapper else: assert 0, "Protocol %r unknown" % context.protocol SERVER = _Server() # Virtual type: (@@: There's clearly something crufty here; # this probably could be more elegant) class _PipeLine(_ObjectType): name = 'pipeline' def invoke(self, context): app = context.app_context.create() filters = [c.create() for c in context.filter_contexts] filters.reverse() for filter in filters: app = filter(app) return app PIPELINE = _PipeLine() class _FilterApp(_ObjectType): name = 'filter_app' def invoke(self, context): next_app = context.next_context.create() filter = context.filter_context.create() return filter(next_app) FILTER_APP = _FilterApp() class _FilterWith(_App): name = 'filtered_with' def invoke(self, context): filter = context.filter_context.create() filtered = context.next_context.create() if context.next_context.object_type is APP: return filter(filtered) else: # filtering a filter def composed(app): return filter(filtered(app)) return composed FILTER_WITH = _FilterWith() ############################################################ ## Loaders ############################################################ def loadapp(uri, name=None, **kw): return loadobj(APP, uri, name=name, **kw) def loadfilter(uri, name=None, **kw): return loadobj(FILTER, uri, name=name, **kw) def loadserver(uri, name=None, **kw): return loadobj(SERVER, uri, name=name, **kw) def appconfig(uri, name=None, relative_to=None, global_conf=None): context = loadcontext(APP, uri, name=name, relative_to=relative_to, global_conf=global_conf) return context.config() _loaders = {} def loadobj(object_type, uri, name=None, relative_to=None, global_conf=None): context = loadcontext( object_type, uri, name=name, relative_to=relative_to, global_conf=global_conf) return context.create() def loadcontext(object_type, uri, name=None, relative_to=None, global_conf=None): if '#' in uri: if name is None: uri, name = uri.split('#', 1) else: # @@: Ignore fragment or error? uri = uri.split('#', 1)[0] if name is None: name = 'main' if ':' not in uri: raise LookupError("URI has no scheme: %r" % uri) scheme, path = uri.split(':', 1) scheme = scheme.lower() if scheme not in _loaders: raise LookupError( "URI scheme not known: %r (from %s)" % (scheme, ', '.join(_loaders.keys()))) return _loaders[scheme]( object_type, uri, path, name=name, relative_to=relative_to, global_conf=global_conf) def _loadconfig(object_type, uri, path, name, relative_to, global_conf): # De-Windowsify the paths: path = path.replace('\\', '/') absolute_path = True if sys.platform == 'win32': _absolute_re = re.compile(r'^[a-zA-Z]:') if not _absolute_re.search(path): absolute_path = False else: if not path.startswith('/'): absolute_path = False if not absolute_path: if not relative_to: raise ValueError( "Cannot resolve relative uri %r; no context keyword " "argument given" % uri) relative_to = relative_to.replace('\\', '/') if relative_to.endswith('/'): path = relative_to + path else: path = relative_to + '/' + path if path.startswith('///'): path = path[2:] path = urllib.unquote(path) loader = ConfigLoader(path) if global_conf: loader.update_defaults(global_conf, overwrite=False) return loader.get_context(object_type, name, global_conf) _loaders['config'] = _loadconfig def _loadegg(object_type, uri, spec, name, relative_to, global_conf): loader = EggLoader(spec) return loader.get_context(object_type, name, global_conf) _loaders['egg'] = _loadegg ############################################################ ## Loaders ############################################################ class _Loader(object): def get_app(self, name=None, global_conf=None): return self.app_context( name=name, global_conf=global_conf).create() def get_filter(self, name=None, global_conf=None): return self.filter_context( name=name, global_conf=global_conf).create() def get_server(self, name=None, global_conf=None): return self.server_context( name=name, global_conf=global_conf).create() def app_context(self, name=None, global_conf=None): return self.get_context( APP, name=name, global_conf=global_conf) def filter_context(self, name=None, global_conf=None): return self.get_context( FILTER, name=name, global_conf=global_conf) def server_context(self, name=None, global_conf=None): return self.get_context( SERVER, name=name, global_conf=global_conf) _absolute_re = re.compile(r'^[a-zA-Z]+:') def absolute_name(self, name): """ Returns true if the name includes a scheme """ if name is None: return False return self._absolute_re.search(name) class ConfigLoader(_Loader): def __init__(self, filename): self.filename = filename = filename.strip() self.parser = NicerConfigParser(self.filename) # Don't lower-case keys: self.parser.optionxform = str # Stupid ConfigParser ignores files that aren't found, so # we have to add an extra check: if not os.path.exists(filename): raise OSError( "File %r not found" % filename) self.parser.read(filename) self.parser._defaults.setdefault( 'here', os.path.dirname(os.path.abspath(filename))) self.parser._defaults.setdefault( '__file__', os.path.abspath(filename)) def update_defaults(self, new_defaults, overwrite=True): for key, value in new_defaults.items(): if not overwrite and key in self.parser._defaults: continue self.parser._defaults[key] = value def get_context(self, object_type, name=None, global_conf=None): if self.absolute_name(name): return loadcontext(object_type, name, relative_to=os.path.dirname(self.filename), global_conf=global_conf) section = self.find_config_section( object_type, name=name) if global_conf is None: global_conf = {} else: global_conf = global_conf.copy() defaults = self.parser.defaults() global_conf.update(defaults) local_conf = {} global_additions = {} get_from_globals = {} for option in self.parser.options(section): if option.startswith('set '): name = option[4:].strip() global_additions[name] = global_conf[name] = ( self.parser.get(section, option)) elif option.startswith('get '): name = option[4:].strip() get_from_globals[name] = self.parser.get(section, option) else: if option in defaults: # @@: It's a global option (?), so skip it continue local_conf[option] = self.parser.get(section, option) for local_var, glob_var in get_from_globals.items(): local_conf[local_var] = global_conf[glob_var] if object_type in (APP, FILTER) and 'filter-with' in local_conf: filter_with = local_conf.pop('filter-with') else: filter_with = None if 'require' in local_conf: for spec in local_conf['require'].split(): pkg_resources.require(spec) del local_conf['require'] if section.startswith('filter-app:'): context = self._filter_app_context( object_type, section, name=name, global_conf=global_conf, local_conf=local_conf, global_additions=global_additions) elif section.startswith('pipeline:'): context = self._pipeline_app_context( object_type, section, name=name, global_conf=global_conf, local_conf=local_conf, global_additions=global_additions) elif 'use' in local_conf: context = self._context_from_use( object_type, local_conf, global_conf, global_additions, section) else: context = self._context_from_explicit( object_type, local_conf, global_conf, global_additions, section) if filter_with is not None: filter_with_context = LoaderContext( obj=None, object_type=FILTER_WITH, protocol=None, global_conf=global_conf, local_conf=local_conf, loader=self) filter_with_context.filter_context = self.filter_context( name=filter_with, global_conf=global_conf) filter_with_context.next_context = context return filter_with_context return context def _context_from_use(self, object_type, local_conf, global_conf, global_additions, section): use = local_conf.pop('use') context = self.get_context( object_type, name=use, global_conf=global_conf) context.global_conf.update(global_additions) context.local_conf.update(local_conf) # @@: Should loader be overwritten? context.loader = self return context def _context_from_explicit(self, object_type, local_conf, global_conf, global_addition, section): possible = [] for protocol_options in object_type.egg_protocols: for protocol in protocol_options: if protocol in local_conf: possible.append((protocol, local_conf[protocol])) break if len(possible) > 1: raise LookupError( "Multiple protocols given in section %r: %s" % (section, possible)) if not possible: raise LookupError( "No loader given in section %r" % section) found_protocol, found_expr = possible[0] del local_conf[found_protocol] value = import_string(found_expr) context = LoaderContext( value, object_type, found_protocol, global_conf, local_conf, self) return context def _filter_app_context(self, object_type, section, name, global_conf, local_conf, global_additions): if 'next' not in local_conf: raise LookupError( "The [%s] section in %s is missing a 'next' setting" % (section, self.filename)) next_name = local_conf.pop('next') context = LoaderContext(None, FILTER_APP, None, global_conf, local_conf, self) context.next_context = self.get_context( APP, next_name, global_conf) if 'use' in local_conf: context.filter_context = self._context_from_use( FILTER, local_conf, global_conf, global_additions, section) else: context.filter_context = self._context_from_explicit( FILTER, local_conf, global_conf, global_additions, section) return context def _pipeline_app_context(self, object_type, section, name, global_conf, local_conf, global_additions): if 'pipeline' not in local_conf: raise LookupError( "The [%s] section in %s is missing a 'pipeline' setting" % (section, self.filename)) pipeline = local_conf.pop('pipeline').split() if local_conf: raise LookupError( "The [%s] pipeline section in %s has extra " "(disallowed) settings: %s" % (', '.join(local_conf.keys()))) context = LoaderContext(None, PIPELINE, None, global_conf, local_conf, self) context.app_context = self.get_context( APP, pipeline[-1], global_conf) context.filter_contexts = [ self.get_context(FILTER, name, global_conf) for name in pipeline[:-1]] return context def find_config_section(self, object_type, name=None): """ Return the section name with the given name prefix (following the same pattern as ``protocol_desc`` in ``config``. It must have the given name, or for ``'main'`` an empty name is allowed. The prefix must be followed by a ``:``. Case is *not* ignored. """ possible = [] for name_options in object_type.config_prefixes: for name_prefix in name_options: found = self._find_sections( self.parser.sections(), name_prefix, name) if found: possible.extend(found) break if not possible: raise LookupError( "No section %r (prefixed by %s) found in config %s" % (name, ' or '.join(map(repr, _flatten(object_type.config_prefixes))), self.filename)) if len(possible) > 1: raise LookupError( "Ambiguous section names %r for section %r (prefixed by %s) " "found in config %s" % (possible, name, ' or '.join(map(repr, _flatten(object_type.config_prefixes))), self.filename)) return possible[0] def _find_sections(self, sections, name_prefix, name): found = [] if name is None: if name_prefix in sections: found.append(name_prefix) name = 'main' for section in sections: if section.startswith(name_prefix+':'): if section[len(name_prefix)+1:].strip() == name: found.append(section) return found class EggLoader(_Loader): def __init__(self, spec): self.spec = spec def get_context(self, object_type, name=None, global_conf=None): if self.absolute_name(name): return loadcontext(object_type, name, global_conf=global_conf) entry_point, protocol, ep_name = self.find_egg_entry_point( object_type, name=name) return LoaderContext( entry_point, object_type, protocol, global_conf or {}, {}, self, distribution=pkg_resources.get_distribution(self.spec), entry_point_name=ep_name) def find_egg_entry_point(self, object_type, name=None): """ Returns the (entry_point, protocol) for the with the given ``name``. """ if name is None: name = 'main' possible = [] for protocol_options in object_type.egg_protocols: for protocol in protocol_options: pkg_resources.require(self.spec) entry = pkg_resources.get_entry_info( self.spec, protocol, name) if entry is not None: possible.append((entry.load(), protocol, entry.name)) break if not possible: # Better exception dist = pkg_resources.get_distribution(self.spec) raise LookupError( "Entry point %r not found in egg %r (dir: %s; protocols: %s; " "entry_points: %s)" % (name, self.spec, dist.location, ', '.join(_flatten(object_type.egg_protocols)), ', '.join(_flatten([ (pkg_resources.get_entry_info(self.spec, prot, name) or {}).keys() for prot in protocol_options] or '(no entry points)')))) if len(possible) > 1: raise LookupError( "Ambiguous entry points for %r in egg %r (protocols: %s)" % (name, self.spec, ', '.join(_flatten(protocol_options)))) return possible[0] class LoaderContext(object): def __init__(self, obj, object_type, protocol, global_conf, local_conf, loader, distribution=None, entry_point_name=None): self.object = obj self.object_type = object_type self.protocol = protocol #assert protocol in _flatten(object_type.egg_protocols), ( # "Bad protocol %r; should be one of %s" # % (protocol, ', '.join(map(repr, _flatten(object_type.egg_protocols))))) self.global_conf = global_conf self.local_conf = local_conf self.loader = loader self.distribution = distribution self.entry_point_name = entry_point_name def create(self): return self.object_type.invoke(self) def config(self): conf = AttrDict(self.global_conf) conf.update(self.local_conf) conf.local_conf = self.local_conf conf.global_conf = self.global_conf conf.context = self return conf class AttrDict(dict): """ A dictionary that can be assigned to. """ pass PK.68I%  !paste/deploy/paster_templates.pyo; IFc@s0dkZdklZdefdYZdS(N(sTemplates PasteDeploycBs/tZdZdZdgZdgZdZRS(Nspaster_templates/paste_deploys/A web application deployed through paste.deploys PasteDeploysPasteScript#basic_packagecCsx=dgD]2}|itii|ddd|dtq W|itii|ddd|dt |i o dd GHd GHd GHdd GHndS( Ns PasteDeployssetup.pysExtra requirementss%r, sindents Entry pointssD [paste.app_factory] main = %(package)s.wsgiapp:make_app s*iHsH* Run "paster serve docs/devel_config.ini" to run the sample applications* on http://localhost:8080( sprereqscommandsinsert_into_filesosspathsjoins output_dirsTruesvarssFalsesverbose(sselfscommands output_dirsvarssprereq((sAbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/paster_templates.pysposts    (s__name__s __module__s _template_dirssummarys egg_pluginssrequired_templatesspost(((sAbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/paster_templates.pys PasteDeploys   (sosspaste.script.templatessTemplates PasteDeploy(s PasteDeploysossTemplate((sAbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/paster_templates.pys?s  PK j6* paste/deploy/interfaces.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php ############################################################ ## Functions ############################################################ def loadapp(uri, name=None, relative_to=None, global_conf=None): """ Provided by ``paste.deploy.loadapp``. Load the specified URI as a WSGI application (returning IWSGIApp). The ``name`` can be in the URI (typically as ``#name``). If it is and ``name`` is given, the keyword argument overrides the URI. If the URI contains a relative filename, then ``relative_to`` is used (if ``relative_to`` is not provided, then it is an error). ``global_conf`` is used to load the configuration (additions override the values). ``global_conf`` is copied before modifying. """ def loadfilter(uri, name=None, relative_to=None, global_conf=None): """ Provided by ``paste.deploy.loadfilter``. Like ``loadapp()``, except returns in IFilter object. """ def loadserver(uri, name=None, relative_to=None, global_conf=None): """ Provided by ``paste.deploy.loadserver``. Like ``loadapp()``, except returns in IServer object. """ ############################################################ ## Factories ############################################################ class IPasteAppFactory(object): """ This is the spec for the ``paste.app_factory`` protocol/entry_point. """ def __call__(global_conf, **local_conf): """ Returns a WSGI application (IWSGIAPP) given the global configuration and the local configuration passed in as keyword arguments. All keys are strings, but values in local_conf may not be valid Python identifiers (if you use ``**kw`` you can still capture these values). """ class IPasteCompositFactory(object): """ This is the spec for the ``paste.composit_factory`` protocol/entry_point. This also produces WSGI applications, like ``paste.app_factory``, but is given more access to the context in which it is loaded. """ def __call__(loader, global_conf, **local_conf): """ Like IPasteAppFactory this returns a WSGI application (IWSGIApp). The ``loader`` value conforms to the ``ILoader`` interface, and can be used to load (contextually) more applications. """ class IPasteFilterFactory(object): """ This is the spec for the ``paste.filter_factory`` protocol/entry_point. """ def __call__(global_conf, **local_conf): """ Returns a IFilter object. """ class IPasteFilterAppFactory(object): """ This is the spec for the ``paste.filter_app_factory`` protocol/entry_point. """ def __call__(wsgi_app, global_conf, **local_conf): """ Returns a WSGI application that wraps ``wsgi_app``. Note that paste.deploy creates a wrapper for these objects that implement the IFilter interface. """ class IPasteServerFactory(object): """ This is the spec for the ``paste.server_factory`` protocol/entry_point. """ def __call__(global_conf, **local_conf): """ Returns a IServer object. """ class IPasteServerRunner(object): """ This is the spec for the ``paste.server_runner`` protocol/entry_point. """ def __call__(wsgi_app, global_conf, **local_conf): """ Serves the given WSGI application. May serve once, many times, forever; nothing about how the server works is specified here. Note that paste.deploy creates a wrapper for these objects that implement the IServer interface. """ class ILoader(object): """ This is an object passed into ``IPasteCompositFactory``. It is currently implemented in ``paste.deploy.loadwsgi`` by ``ConfigLoader`` and ``EggLoader``. """ def get_app(name_or_uri, global_conf=None): """ Return an IWSGIApp object. If the loader supports named applications, then you can use a simple name; otherwise you must use a full URI. Any global configuration you pass in will be added; you should generally pass through the global configuration you received. """ def get_filter(name_or_uri, global_conf=None): """ Return an IFilter object, like ``get_app``. """ def get_server(name_or_uri, global_conf=None): """ Return an IServer object, like ``get_app``. """ ############################################################ ## Objects ############################################################ class IWSGIApp(object): """ This is an application that conforms to `PEP 333 `_: Python Web Server Gateway Interface v1.0 """ def __call__(environ, start_response): """ Calls ``start_response(status_code, header_list)`` and returns an iterator for the body of the response. """ class IFilter(object): """ A filter is a simple case of middleware, where an object wraps a single WSGI application (IWSGIApp). """ def __call__(wsgi_app): """ Returns an IWSGIApp object, typically one that wraps the ``wsgi_app`` passed in. """ class IServer(object): """ A simple server interface. """ def __call__(wsgi_app): """ Serves the given WSGI application. May serve once, many times, forever; nothing about how the server works is specified here. """ PK.68CCpaste/deploy/converters.pyc; IFc@sdZeedZdS(cCst|ttfot|ii}|ddddddgjotSq|ddd d d d gjotSqtd |nt |SdS(Nstruesyessonsysts1sfalsesnosoffsnsfs0sString is not true/false: %r( s isinstancesobjsstrsunicodesstripslowersTruesFalses ValueErrorsbool(sobj((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/converters.pysasboolscCst|ttfoO|i|}|o1gi}|D]}||iq:~}n|Sn;t|t t fo|Sn|t jogSn|gSdS(N(s isinstancesobjsstrsunicodessplitssepslstsstripsappends_[1]svsliststuplesNone(sobjssepsstripsvs_[1]slst((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/converters.pysaslists1 N(sasboolsNonesTruesaslist(saslistsasbool((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/converters.pys?s PK.68>$brrpaste/deploy/loadwsgi.pyo; IFc@sRdkZdkZdkZdkZdklZdkZdklZddddgZdZ dZ d Z d efd YZ d e fd YZdefdYZeZdefdYZeZdefdYZeZdefdYZeZdefdYZeZdefdYZeZedZedZedZeeedZhZ eeedZ!eeedZ"d Z#e#e d!|tjogSn&t|ttfo|Sn|gSdS(s Turn object into a list; lists and tuples are left as-is, None becomes [], and everything else turns into a one-element list. N(sobjsNones isinstancesliststuple(sobj((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_aslists  cCsTt|ttf o |gSng}x!|D]}|it|q/W|SdS(s Flatten a nested list. N(s isinstanceslstsliststuplesresultsitemsextends_flatten(slstsitemsresult((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_flatten s sNicerConfigParsercBstZdZdZRS(NcOs ti|||||_dS(N(s ConfigParsers__init__sselfsargsskwsfilename(sselfsfilenamesargsskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__-scCszyti|||||SWnVtj oJ}t |i }d|i ||||f|d(sselfsnames egg_protocolssconfig_prefixes(sself((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__repr__KscCst|i|i|iSdS(N(sfix_callscontextsobjects global_confs local_conf(sselfscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokeOs ( s__name__s __module__sNonesnames egg_protocolssconfig_prefixess__init__s__repr__sinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _ObjectType@s   s_AppcBsDtZdZdddgZddgddgdd gZd ZRS( Ns applicationspaste.app_factoryspaste.composite_factoryspaste.composit_factorysapps compositescompositspipelines filter-appcCsj|iddfjo#t|i|i|i|iSn.|idjot|i|i|iSndS(Nspaste.composit_factoryspaste.composite_factoryspaste.app_factory(scontextsprotocolsfix_callsobjectsloaders global_confs local_conf(sselfscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvoke\s  (s__name__s __module__snames egg_protocolssconfig_prefixessinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_AppTss_FiltercBs/tZdZddggZdgZdZRS(Nsfilterspaste.filter_factoryspaste.filter_app_factorycsUidjotiiiSn%idjod}|SndS(Nspaste.filter_factoryspaste.filter_app_factorycs ti|iiSdS(N(sfix_callscontextsobjectswsgi_apps global_confs local_conf(swsgi_app(scontext(s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfilter_wrapperss (scontextsprotocolsfix_callsobjects global_confs local_confsfilter_wrapper(sselfscontextsfilter_wrapper((scontexts9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokens  (s__name__s __module__snames egg_protocolssconfig_prefixessinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_Filteris s_ServercBs/tZdZddggZdgZdZRS(Nsserverspaste.server_factoryspaste.server_runnercsUidjotiiiSn%idjod}|SndS(Nspaste.server_factoryspaste.server_runnercs ti|iiSdS(N(sfix_callscontextsobjectswsgi_apps global_confs local_conf(swsgi_app(scontext(s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysserver_wrappers (scontextsprotocolsfix_callsobjects global_confs local_confsserver_wrapper(sselfscontextsserver_wrapper((scontexts9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes  (s__name__s __module__snames egg_protocolssconfig_prefixessinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_Server~s s _PipeLinecBstZdZdZRS(NspipelinecCsn|ii}gi}|iD]}||iq ~}|i x|D]}||}qPW|SdS(N( scontexts app_contextscreatesappsappends_[1]sfilter_contextsscsfilterssreversesfilter(sselfscontextsfilterscsfilterss_[1]sapp((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes0 (s__name__s __module__snamesinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _PipeLiness _FilterAppcBstZdZdZRS(Ns filter_appcCs,|ii}|ii}||SdS(N(scontexts next_contextscreatesnext_appsfilter_contextsfilter(sselfscontextsfiltersnext_app((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes(s__name__s __module__snamesinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _FilterAppss _FilterWithcBstZdZdZRS(Ns filtered_withcsV|ii|ii|iitjoSnd}|SdS(Ncs|SdS(N(sfiltersfilteredsapp(sapp(sfiltersfiltered(s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pyscomposeds( scontextsfilter_contextscreatesfilters next_contextsfiltereds object_typesAPPscomposed(sselfscontextscomposedsfiltersfiltered((sfiltersfiltereds9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes (s__name__s __module__snamesinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _FilterWithscKstt|d||SdS(Nsname(sloadobjsAPPsurisnameskw(surisnameskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysloadappscKstt|d||SdS(Nsname(sloadobjsFILTERsurisnameskw(surisnameskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys loadfilterscKstt|d||SdS(Nsname(sloadobjsSERVERsurisnameskw(surisnameskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys loadserversc Cs/tt|d|d|d|}|iSdS(Nsnames relative_tos global_conf(s loadcontextsAPPsurisnames relative_tos global_confscontextsconfig(surisnames relative_tos global_confscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys appconfigs c Cs/t||d|d|d|}|iSdS(Nsnames relative_tos global_conf(s loadcontexts object_typesurisnames relative_tos global_confscontextscreate(s object_typesurisnames relative_tos global_confscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysloadobjs c Cs d|joC|tjo|idd\}}qP|iddd}n|tjo d}nd|jotd|n|idd\}}|i}|tjo)td|di ti fnt||||d |d |d |SdS( Ns#iismains:sURI has no scheme: %rs"URI scheme not known: %r (from %s)s, snames relative_tos global_conf(surisnamesNonessplits LookupErrorsschemespathslowers_loaderssjoinskeyss object_types relative_tos global_conf(s object_typesurisnames relative_tos global_confsschemespath((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys loadcontexts       ) c CsE|idd}t}tidjo.tid}|i | o t }qqn|i d o t }n| o^| ot d|n|idd}|ido||}q|d|}n|i do|d}nti|}t|}|o|i|dt n|i|||SdS( Ns\s/swin32s ^[a-zA-Z]:sACannot resolve relative uri %r; no context keyword argument givens///is overwrite(spathsreplacesTrues absolute_pathssyssplatformsrescompiles _absolute_ressearchsFalses startswiths relative_tos ValueErrorsurisendswithsurllibsunquotes ConfigLoadersloaders global_confsupdate_defaultss get_contexts object_typesname( s object_typesurispathsnames relative_tos global_confs _absolute_res absolute_pathsloader((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _loadconfigs,  sconfigcCs#t|}|i|||SdS(N(s EggLoadersspecsloaders get_contexts object_typesnames global_conf(s object_typesurisspecsnames relative_tos global_confsloader((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_loadeggs seggs_LoadercBsztZeedZeedZeedZeedZeedZeedZe i dZ dZ RS( NcCs |id|d|iSdS(Nsnames global_conf(sselfs app_contextsnames global_confscreate(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysget_appscCs |id|d|iSdS(Nsnames global_conf(sselfsfilter_contextsnames global_confscreate(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys get_filter scCs |id|d|iSdS(Nsnames global_conf(sselfsserver_contextsnames global_confscreate(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys get_server$scCs|itd|d|SdS(Nsnames global_conf(sselfs get_contextsAPPsnames global_conf(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys app_context(scCs|itd|d|SdS(Nsnames global_conf(sselfs get_contextsFILTERsnames global_conf(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfilter_context,scCs|itd|d|SdS(Nsnames global_conf(sselfs get_contextsSERVERsnames global_conf(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysserver_context0ss ^[a-zA-Z]+:cCs)|tjotSn|ii|SdS(s< Returns true if the name includes a scheme N(snamesNonesFalsesselfs _absolute_ressearch(sselfsname((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys absolute_name5s ( s__name__s __module__sNonesget_apps get_filters get_servers app_contextsfilter_contextsserver_contextsrescompiles _absolute_res absolute_name(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_Loaderss ConfigLoadercBsetZdZedZeedZdZdZdZ dZ edZ d Z RS( NcCs|i|_}t|i|_t|i_tii | ot d|n|ii ||ii i dtiitii||ii i dtii|dS(NsFile %r not foundsheres__file__(sfilenamesstripsselfsNicerConfigParsersparsersstrs optionxformsosspathsexistssOSErrorsreads _defaultss setdefaultsdirnamesabspath(sselfsfilename((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__?s .cCsSxL|iD]>\}}| o||iijoq n||ii|t d||di ttt|i|ifn|dSdS(s/ Return the section name with the given name prefix (following the same pattern as ``protocol_desc`` in ``config``. It must have the given name, or for ``'main'`` an empty name is allowed. The prefix must be followed by a ``:``. Case is *not* ignored. s1No section %r (prefixed by %s) found in config %ss or isMAmbiguous section names %r for section %r (prefixed by %s) found in config %siN(spossibles object_typesconfig_prefixess name_optionss name_prefixsselfs_find_sectionssparserssectionssnamesfoundsextends LookupErrorsjoinsmapsreprs_flattensfilenameslen(sselfs object_typesnamespossibles name_optionssfounds name_prefix((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfind_config_sections   ;>cCsg}|tjo(||jo|i|nd}nxX|D]P}|i|do6|t|di |jo|i|qqBqBW|SdS(Nsmains:i( sfoundsnamesNones name_prefixssectionssappendssections startswithslensstrip(sselfssectionss name_prefixsnamesfoundssection((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_find_sectionss   !( s__name__s __module__s__init__sTruesupdate_defaultssNones get_contexts_context_from_uses_context_from_explicits_filter_app_contexts_pipeline_app_contextsfind_config_sections_find_sections(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys ConfigLoader=s  F    s EggLoadercBs,tZdZeedZedZRS(NcCs ||_dS(N(sspecsself(sselfsspec((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__sc Cs|i|ot||d|Sn|i|d|\}}}t ||||phh|dt i |i d|SdS(Ns global_confsnames distributionsentry_point_name(sselfs absolute_namesnames loadcontexts object_types global_confsfind_egg_entry_points entry_pointsprotocolsep_names LoaderContexts pkg_resourcessget_distributionsspec(sselfs object_typesnames global_confsprotocolsep_names entry_point((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys get_contexts  c Cs|tjo d}ng}x{|iD]p}xg|D]_}ti|i ti |i ||}|tj o$|i |i||ifPq4q4Wq'W| oti|i } td||i | idit|iditgi }|D]/}|ti |i ||phiq~pdfnt|djo/td||i dit|fn|dSdS( s^ Returns the (entry_point, protocol) for the with the given ``name``. smainsMEntry point %r not found in egg %r (dir: %s; protocols: %s; entry_points: %s)s, s(no entry points)is7Ambiguous entry points for %r in egg %r (protocols: %s)iN(snamesNonespossibles object_types egg_protocolssprotocol_optionssprotocols pkg_resourcessrequiresselfsspecsget_entry_infosentrysappendsloadsget_distributionsdists LookupErrorslocationsjoins_flattens_[1]sprotskeysslen( sselfs object_typesnamesprotsprotocolspossibles_[1]sprotocol_optionssentrysdist((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfind_egg_entry_point(s*        /(s__name__s __module__s__init__sNones get_contextsfind_egg_entry_point(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys EggLoaders s LoaderContextcBs)tZeedZdZdZRS(Nc CsL||_||_||_||_||_||_||_||_ dS(N( sobjsselfsobjects object_typesprotocols global_confs local_confsloaders distributionsentry_point_name( sselfsobjs object_typesprotocols global_confs local_confsloaders distributionsentry_point_name((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__Ns       cCs|ii|SdS(N(sselfs object_typesinvoke(sself((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pyscreate]scCsHt|i}|i|i|i|_|i|_||_|SdS(N(sAttrDictsselfs global_confsconfsupdates local_confscontext(sselfsconf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysconfig`s    (s__name__s __module__sNones__init__screatesconfig(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys LoaderContextLs sAttrDictcBstZdZRS(s/ A dictionary that can be assigned to. (s__name__s __module__s__doc__(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysAttrDicths (+sossressyssurllibs ConfigParsers pkg_resourcesspaste.deploy.util.fixtypeerrorsfix_calls__all__s import_strings_aslists_flattensNicerConfigParsersobjects _ObjectTypes_AppsAPPs_FiltersFILTERs_ServersSERVERs _PipeLinesPIPELINEs _FilterApps FILTER_APPs _FilterWiths FILTER_WITHsNonesloadapps loadfilters loadservers appconfigs_loaderssloadobjs loadcontexts _loadconfigs_loadeggs_Loaders ConfigLoaders EggLoaders LoaderContextsdictsAttrDict('s FILTER_APPs_Filters_Apps_Servers ConfigLoaders loadfiltersFILTERs _FilterApps__all__s_loaderss LoaderContexts_aslistsurllibsres _FilterWiths_LoadersNicerConfigParsers loadservers EggLoadersloadobjs _ObjectTypes FILTER_WITHssyssloadapps _loadconfigs_loadeggs ConfigParsers _PipeLinesPIPELINEsossAPPs pkg_resourcess loadcontextsSERVERs import_strings_flattensAttrDictsfix_calls appconfig((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys?sP                      #8PK.689MI3I3paste/deploy/config.pyo; IFc@sdZdkZdkZeaeaddddgZdZdefdYZ e Z defdYZ d Z e iZ defd YZd eeed Zeie_dS( s*Paste Configuration Middleware and ObjectsNsDispatchingConfigsCONFIGsConfigMiddlewaresPrefixMiddlewarecCsoy tiSWn]tj o.dklataht_}|Sn%tj oht_}|SnXdS(N(slocal(s config_locals wsgi_dicts NameErrors paste.deploy.util.threadinglocalslocalsresultsAttributeError(sresult((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys local_dict s     cBstZdZeiZdZdZedZ dZ dZ edZ dZ dZd Zd Zd ZRS( s This is a configuration object that can be used globally, imported, have references held onto. The configuration may differ by thread (or may not). Specific configurations are registered (and deregistered) either for the process or for threads. cCs|iizWd|_xGno?d|i|_ti|i oPn|id7_q#WWd|iiXg|_dS(Niispaste.processconfig_%i( sselfs_constructor_locksacquiresdispatching_ids _local_keys local_dictshas_keysreleases_process_configs(sself((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys__init__*s  cCs#ti|igi|dS(s Make ``conf`` the active configuration for this thread. Thread-local configuration always overrides process-wide configuration. This should be used like:: conf = make_conf() dispatching_config.push_thread_config(conf) try: ... do stuff ... finally: dispatching_config.pop_thread_config(conf) N(s local_dicts setdefaultsselfs _local_keysappendsconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspush_thread_config7scCs|it|i|dS(s Remove a thread-local configuration. If ``conf`` is given, it is checked against the popped configuration and an error is emitted if they don't match. N(sselfs _pop_froms local_dicts _local_keysconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspop_thread_configHscCsD|i}|tj o ||j otd||fndS(NsBThe config popped (%s) is not the same as the config expected (%s)(slstspopspoppedsconfsNonesAssertionError(sselfslstsconfspopped((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys _pop_fromPs cCs|ii|dS(sg Like push_thread_config, but applies the configuration to the entire process. N(sselfs_process_configssappendsconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspush_process_configXscCs|i|i|dS(N(sselfs _pop_froms_process_configssconf(sselfsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pyspop_process_config_scCs:|i}|tjotdnt||SdS(Ns?No configuration has been registered for this process or thread(sselfs current_confsconfsNonesAttributeErrorsgetattrsattr(sselfsattrsconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys __getattr__bs  cCsIti|i}|o |dSn|io|idSntSdS(Ni(s local_dictsgetsselfs _local_keysthread_configss_process_configssNone(sselfsthread_configs((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys current_confjs   cCs5|i}|tjotdn||SdS(Ns?No configuration has been registered for this process or thread(sselfs current_confsconfsNones TypeErrorskey(sselfskeysconf((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys __getitem__ss  cCs|i|SdS(N(sselfshas_keyskey(sselfskey((s7build/bdist.darwin-8.0.1-x86/egg/paste/deploy/config.pys __contains__|scCs|i}|||`_: Python Web Server Gateway Interface v1.0 cCsdS(s Calls ``start_response(status_code, header_list)`` and returns an iterator for the body of the response. N((senvironsstart_response((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys__call__s(s__name__s __module__s__doc__s__call__(((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pysIWSGIApps sIFiltercBstZdZdZRS(sr A filter is a simple case of middleware, where an object wraps a single WSGI application (IWSGIApp). cCsdS(sj Returns an IWSGIApp object, typically one that wraps the ``wsgi_app`` passed in. N((swsgi_app((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys__call__s(s__name__s __module__s__doc__s__call__(((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pysIFilters sIServercBstZdZdZRS(s$ A simple server interface. cCsdS(s Serves the given WSGI application. May serve once, many times, forever; nothing about how the server works is specified here. N((swsgi_app((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys__call__s(s__name__s __module__s__doc__s__call__(((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pysIServers N(sNonesloadapps loadfilters loadserversobjectsIPasteAppFactorysIPasteCompositFactorysIPasteFilterFactorysIPasteFilterAppFactorysIPasteServerFactorysIPasteServerRunnersILoadersIWSGIAppsIFiltersIServer( s loadfiltersIFiltersIWSGIAppsIServersIPasteFilterFactorysIPasteServerRunnersIPasteServerFactorysIPasteCompositFactorysloadappsILoadersIPasteAppFactorysIPasteFilterAppFactorys loadserver((s;build/bdist.darwin-8.0.1-x86/egg/paste/deploy/interfaces.pys?s     PK.68 ttpaste/deploy/loadwsgi.pyc; IFc@sRdkZdkZdkZdkZdklZdkZdklZddddgZdZ dZ d Z d efd YZ d e fd YZdefdYZeZdefdYZeZdefdYZeZdefdYZeZdefdYZeZdefdYZeZedZedZedZeeedZhZ eeedZ!eeedZ"d Z#e#e d!|tjogSn&t|ttfo|Sn|gSdS(s Turn object into a list; lists and tuples are left as-is, None becomes [], and everything else turns into a one-element list. N(sobjsNones isinstancesliststuple(sobj((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_aslists  cCsTt|ttf o |gSng}x!|D]}|it|q/W|SdS(s Flatten a nested list. N(s isinstanceslstsliststuplesresultsitemsextends_flatten(slstsitemsresult((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_flatten s sNicerConfigParsercBstZdZdZRS(NcOs ti|||||_dS(N(s ConfigParsers__init__sselfsargsskwsfilename(sselfsfilenamesargsskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__-scCszyti|||||SWnVtj oJ}t |i }d|i ||||f|d(sselfsnames egg_protocolssconfig_prefixes(sself((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__repr__KscCs=|it|ijptt|i|i|i SdS(N( scontextsprotocols_flattensselfs egg_protocolssAssertionErrorsfix_callsobjects global_confs local_conf(sselfscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokeOs  ( s__name__s __module__sNonesnames egg_protocolssconfig_prefixess__init__s__repr__sinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _ObjectType@s   s_AppcBsDtZdZdddgZddgddgdd gZd ZRS( Ns applicationspaste.app_factoryspaste.composite_factoryspaste.composit_factorysapps compositescompositspipelines filter-appcCs|iddfjo#t|i|i|i|iSnF|idjot|i|i|iSndptd|idS(Nspaste.composit_factoryspaste.composite_factoryspaste.app_factoryisProtocol %r unknown(scontextsprotocolsfix_callsobjectsloaders global_confs local_confsAssertionError(sselfscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvoke\s  (s__name__s __module__snames egg_protocolssconfig_prefixessinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_AppTss_FiltercBs/tZdZddggZdgZdZRS(Nsfilterspaste.filter_factoryspaste.filter_app_factorycsmidjotiiiSn=idjod}|SndptdidS(Nspaste.filter_factoryspaste.filter_app_factorycs ti|iiSdS(N(sfix_callscontextsobjectswsgi_apps global_confs local_conf(swsgi_app(scontext(s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfilter_wrapperss isProtocol %r unknown(scontextsprotocolsfix_callsobjects global_confs local_confsfilter_wrappersAssertionError(sselfscontextsfilter_wrapper((scontexts9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokens  (s__name__s __module__snames egg_protocolssconfig_prefixessinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_Filteris s_ServercBs/tZdZddggZdgZdZRS(Nsserverspaste.server_factoryspaste.server_runnercsmidjotiiiSn=idjod}|SndptdidS(Nspaste.server_factoryspaste.server_runnercs ti|iiSdS(N(sfix_callscontextsobjectswsgi_apps global_confs local_conf(swsgi_app(scontext(s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysserver_wrappers isProtocol %r unknown(scontextsprotocolsfix_callsobjects global_confs local_confsserver_wrappersAssertionError(sselfscontextsserver_wrapper((scontexts9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes  (s__name__s __module__snames egg_protocolssconfig_prefixessinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_Server~s s _PipeLinecBstZdZdZRS(NspipelinecCsn|ii}gi}|iD]}||iq ~}|i x|D]}||}qPW|SdS(N( scontexts app_contextscreatesappsappends_[1]sfilter_contextsscsfilterssreversesfilter(sselfscontextsfilterscsfilterss_[1]sapp((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes0 (s__name__s __module__snamesinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _PipeLiness _FilterAppcBstZdZdZRS(Ns filter_appcCs,|ii}|ii}||SdS(N(scontexts next_contextscreatesnext_appsfilter_contextsfilter(sselfscontextsfiltersnext_app((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes(s__name__s __module__snamesinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _FilterAppss _FilterWithcBstZdZdZRS(Ns filtered_withcsV|ii|ii|iitjoSnd}|SdS(Ncs|SdS(N(sfiltersfilteredsapp(sapp(sfiltersfiltered(s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pyscomposeds( scontextsfilter_contextscreatesfilters next_contextsfiltereds object_typesAPPscomposed(sselfscontextscomposedsfiltersfiltered((sfiltersfiltereds9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysinvokes (s__name__s __module__snamesinvoke(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _FilterWithscKstt|d||SdS(Nsname(sloadobjsAPPsurisnameskw(surisnameskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysloadappscKstt|d||SdS(Nsname(sloadobjsFILTERsurisnameskw(surisnameskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys loadfilterscKstt|d||SdS(Nsname(sloadobjsSERVERsurisnameskw(surisnameskw((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys loadserversc Cs/tt|d|d|d|}|iSdS(Nsnames relative_tos global_conf(s loadcontextsAPPsurisnames relative_tos global_confscontextsconfig(surisnames relative_tos global_confscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys appconfigs c Cs/t||d|d|d|}|iSdS(Nsnames relative_tos global_conf(s loadcontexts object_typesurisnames relative_tos global_confscontextscreate(s object_typesurisnames relative_tos global_confscontext((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysloadobjs c Cs d|joC|tjo|idd\}}qP|iddd}n|tjo d}nd|jotd|n|idd\}}|i}|tjo)td|di ti fnt||||d |d |d |SdS( Ns#iismains:sURI has no scheme: %rs"URI scheme not known: %r (from %s)s, snames relative_tos global_conf(surisnamesNonessplits LookupErrorsschemespathslowers_loaderssjoinskeyss object_types relative_tos global_conf(s object_typesurisnames relative_tos global_confsschemespath((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys loadcontexts       ) c CsE|idd}t}tidjo.tid}|i | o t }qqn|i d o t }n| o^| ot d|n|idd}|ido||}q|d|}n|i do|d}nti|}t|}|o|i|dt n|i|||SdS( Ns\s/swin32s ^[a-zA-Z]:sACannot resolve relative uri %r; no context keyword argument givens///is overwrite(spathsreplacesTrues absolute_pathssyssplatformsrescompiles _absolute_ressearchsFalses startswiths relative_tos ValueErrorsurisendswithsurllibsunquotes ConfigLoadersloaders global_confsupdate_defaultss get_contexts object_typesname( s object_typesurispathsnames relative_tos global_confs _absolute_res absolute_pathsloader((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys _loadconfigs,  sconfigcCs#t|}|i|||SdS(N(s EggLoadersspecsloaders get_contexts object_typesnames global_conf(s object_typesurisspecsnames relative_tos global_confsloader((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_loadeggs seggs_LoadercBsztZeedZeedZeedZeedZeedZeedZe i dZ dZ RS( NcCs |id|d|iSdS(Nsnames global_conf(sselfs app_contextsnames global_confscreate(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysget_appscCs |id|d|iSdS(Nsnames global_conf(sselfsfilter_contextsnames global_confscreate(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys get_filter scCs |id|d|iSdS(Nsnames global_conf(sselfsserver_contextsnames global_confscreate(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys get_server$scCs|itd|d|SdS(Nsnames global_conf(sselfs get_contextsAPPsnames global_conf(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys app_context(scCs|itd|d|SdS(Nsnames global_conf(sselfs get_contextsFILTERsnames global_conf(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfilter_context,scCs|itd|d|SdS(Nsnames global_conf(sselfs get_contextsSERVERsnames global_conf(sselfsnames global_conf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysserver_context0ss ^[a-zA-Z]+:cCs)|tjotSn|ii|SdS(s< Returns true if the name includes a scheme N(snamesNonesFalsesselfs _absolute_ressearch(sselfsname((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys absolute_name5s ( s__name__s __module__sNonesget_apps get_filters get_servers app_contextsfilter_contextsserver_contextsrescompiles _absolute_res absolute_name(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_Loaderss ConfigLoadercBsetZdZedZeedZdZdZdZ dZ edZ d Z RS( NcCs|i|_}t|i|_t|i_tii | ot d|n|ii ||ii i dtiitii||ii i dtii|dS(NsFile %r not foundsheres__file__(sfilenamesstripsselfsNicerConfigParsersparsersstrs optionxformsosspathsexistssOSErrorsreads _defaultss setdefaultsdirnamesabspath(sselfsfilename((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__?s .cCsSxL|iD]>\}}| o||iijoq n||ii|t d||di ttt|i|ifn|dSdS(s/ Return the section name with the given name prefix (following the same pattern as ``protocol_desc`` in ``config``. It must have the given name, or for ``'main'`` an empty name is allowed. The prefix must be followed by a ``:``. Case is *not* ignored. s1No section %r (prefixed by %s) found in config %ss or isMAmbiguous section names %r for section %r (prefixed by %s) found in config %siN(spossibles object_typesconfig_prefixess name_optionss name_prefixsselfs_find_sectionssparserssectionssnamesfoundsextends LookupErrorsjoinsmapsreprs_flattensfilenameslen(sselfs object_typesnamespossibles name_optionssfounds name_prefix((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfind_config_sections   ;>cCsg}|tjo(||jo|i|nd}nxX|D]P}|i|do6|t|di |jo|i|qqBqBW|SdS(Nsmains:i( sfoundsnamesNones name_prefixssectionssappendssections startswithslensstrip(sselfssectionss name_prefixsnamesfoundssection((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys_find_sectionss   !( s__name__s __module__s__init__sTruesupdate_defaultssNones get_contexts_context_from_uses_context_from_explicits_filter_app_contexts_pipeline_app_contextsfind_config_sections_find_sections(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys ConfigLoader=s  F    s EggLoadercBs,tZdZeedZedZRS(NcCs ||_dS(N(sspecsself(sselfsspec((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__sc Cs|i|ot||d|Sn|i|d|\}}}t ||||phh|dt i |i d|SdS(Ns global_confsnames distributionsentry_point_name(sselfs absolute_namesnames loadcontexts object_types global_confsfind_egg_entry_points entry_pointsprotocolsep_names LoaderContexts pkg_resourcessget_distributionsspec(sselfs object_typesnames global_confsprotocolsep_names entry_point((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys get_contexts  c Cs|tjo d}ng}x{|iD]p}xg|D]_}ti|i ti |i ||}|tj o$|i |i||ifPq4q4Wq'W| oti|i } td||i | idit|iditgi }|D]/}|ti |i ||phiq~pdfnt|djo/td||i dit|fn|dSdS( s^ Returns the (entry_point, protocol) for the with the given ``name``. smainsMEntry point %r not found in egg %r (dir: %s; protocols: %s; entry_points: %s)s, s(no entry points)is7Ambiguous entry points for %r in egg %r (protocols: %s)iN(snamesNonespossibles object_types egg_protocolssprotocol_optionssprotocols pkg_resourcessrequiresselfsspecsget_entry_infosentrysappendsloadsget_distributionsdists LookupErrorslocationsjoins_flattens_[1]sprotskeysslen( sselfs object_typesnamesprotsprotocolspossibles_[1]sprotocol_optionssentrysdist((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysfind_egg_entry_point(s*        /(s__name__s __module__s__init__sNones get_contextsfind_egg_entry_point(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys EggLoaders s LoaderContextcBs)tZeedZdZdZRS(Nc CsL||_||_||_||_||_||_||_||_ dS(N( sobjsselfsobjects object_typesprotocols global_confs local_confsloaders distributionsentry_point_name( sselfsobjs object_typesprotocols global_confs local_confsloaders distributionsentry_point_name((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys__init__Ns       cCs|ii|SdS(N(sselfs object_typesinvoke(sself((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pyscreate]scCsHt|i}|i|i|i|_|i|_||_|SdS(N(sAttrDictsselfs global_confsconfsupdates local_confscontext(sselfsconf((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysconfig`s    (s__name__s __module__sNones__init__screatesconfig(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys LoaderContextLs sAttrDictcBstZdZRS(s/ A dictionary that can be assigned to. (s__name__s __module__s__doc__(((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pysAttrDicths (+sossressyssurllibs ConfigParsers pkg_resourcesspaste.deploy.util.fixtypeerrorsfix_calls__all__s import_strings_aslists_flattensNicerConfigParsersobjects _ObjectTypes_AppsAPPs_FiltersFILTERs_ServersSERVERs _PipeLinesPIPELINEs _FilterApps FILTER_APPs _FilterWiths FILTER_WITHsNonesloadapps loadfilters loadservers appconfigs_loaderssloadobjs loadcontexts _loadconfigs_loadeggs_Loaders ConfigLoaders EggLoaders LoaderContextsdictsAttrDict('s FILTER_APPs_Filters_Apps_Servers ConfigLoaders loadfiltersFILTERs _FilterApps__all__s_loaderss LoaderContexts_aslistsurllibsres _FilterWiths_LoadersNicerConfigParsers loadservers EggLoadersloadobjs _ObjectTypes FILTER_WITHssyssloadapps _loadconfigs_loadeggs ConfigParsers _PipeLinesPIPELINEsossAPPs pkg_resourcess loadcontextsSERVERs import_strings_flattensAttrDictsfix_calls appconfig((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/loadwsgi.pys?sP                      #8PK.68mDpaste/deploy/__init__.pyc; IFc@s2dkTydklZWnej onXdS((s*(sCONFIGN(sloadwsgisconfigsCONFIGs ImportError(sCONFIG((s9build/bdist.darwin-8.0.1-x86/egg/paste/deploy/__init__.pys?sPK j6َQ  paste/deploy/epdesc.pyclass AppFactoryDescription(object): description = """ This gives a factory/function that can create WSGI apps """ class CompositeFactoryDescription(object): description = """ This gives a factory/function that can create WSGI apps, and has access to the application creator so that it can in turn fetch apps based on name. """ class FilterAppFactoryDescription(object): description = """ This gives a factory/function that wraps a WSGI application to create another WSGI application (typically applying middleware) """ class FilterFactoryDescription(object): description = """ This gives a factory/function that return a function that can wrap a WSGI application and returns another WSGI application. paste.filter_app_factory is the same thing with less layers. """ class ServerFactoryDescription(object): description = """ This gives a factory/function that creates a server, that can be called with a WSGI application to run indefinitely. paste.server_runner is the same thing with less layers. """ class ServerRunnerDescription(object): description = """ This gives a factory/function that, given a WSGI application and configuration, will serve the application indefinitely. """ PK j67Epaste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmpl[filter-app:main] # This puts the interactive debugger in place: use = egg:Paste#evalerror next = devel [app:devel] # This application is meant for interactive development use = egg:${project} debug = true # You can add other configuration values: greeting = Aloha! [app:test] # While this version of the configuration is for non-iteractive # tests (unit tests) use = devel [server:main] use = egg:Paste#http # Change to 0.0.0.0 to make public: host = 127.0.0.1 port = 8080 PK j6]Dpaste/deploy/paster_templates/paste_deploy/+package+/wsgiapp.py_tmplimport sampleapp from paste.deploy.config import ConfigMiddleware def make_app( global_conf, # Optional and required configuration parameters # can go here, or just **kw; greeting is required: greeting, **kw): # This is a WSGI application: app = sampleapp.application # Here we merge all the keys into one configuration # dictionary; you don't have to do this, but this # can be convenient later to add ad hoc configuration: conf = global_conf.copy() conf.update(kw) conf['greeting'] = greeting # ConfigMiddleware means that paste.deploy.CONFIG will, # during this request (threadsafe) represent the # configuration dictionary we set up: app = ConfigMiddleware(app, conf) return app PK j6)|  Fpaste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmplimport cgi from paste.deploy import CONFIG def application(environ, start_response): # Note that usually you wouldn't be writing a pure WSGI # application, you might be using some framework or # environment. But as an example... start_response('200 OK', [('Content-type', 'text/html')]) greeting = CONFIG['greeting'] content = [ '%s\n' % greeting, '

%s!

\n' % greeting, '\n', ] items = environ.items() items.sort() for key, value in items: content.append('\n' % (key, cgi.escape(repr(value)))) content.append('
%s%s
') return content PK j6U6paste/deploy/util/__init__.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # PK.68fޗp p "paste/deploy/util/fixtypeerror.pyo; IFc@s7dZdkZdkZdZdZdZdS(s^ Fixes the vague error message that you get when calling a function with the wrong arguments. Nc Csg|tjoti}n|dtjp4t|diddjpt|ddto|Snt|d_ dk }|i |i |}ditt|}|o|o|d7}n|oX|i}|i|digi} |D]\}}| d|q~ 7}nd |} d |d| |f} | f|d_|SdS( sh Given an exception, this will test if the exception was due to a signature error, and annotate the error with better information if so. Usage:: try: val = callable(*args, **kw) except TypeError: exc_info = fix_type_error(None, callable, args, kw) raise exc_info[0], exc_info[1], exc_info[2] iis argumentsis_type_error_fixedNs, s%s=...s(%s)s%s; got %s, wanted %s(sexc_infosNonessyss TypeErrorsstrsfindsgetattrsFalsesTrues_type_error_fixedsinspects formatargspecs getargspecscallablesargspecsjoinsmaps _short_reprsvarargssargsskwargssitemsssortsappends_[1]snsvsgotspecsmsg( sexc_infoscallablesvarargsskwargssinspectsargssvsargspecsnsmsgsgotspecs_[1]((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pysfix_type_error s&  H    B cCsAt|}t|djo|d d|d}n|SdS(Ni is...i(sreprsvslen(sv((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pys _short_repr-s cOs^y|||}Wn@tj o4tt|||}|d|d|dnX|SdS(sR Call ``callable(*args, **kw)`` fixing any type errors that come out. iiiN(scallablesargsskwsvals TypeErrorsfix_type_errorsNonesexc_info(scallablesargsskwsvalsexc_info((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pysfix_call3s(s__doc__sinspectssyssfix_type_errors _short_reprsfix_call(ssyssfix_type_errorsinspectsfix_calls _short_repr((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pys?s    # PK j64YY#paste/deploy/util/threadinglocal.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php try: import threading except ImportError: # No threads, so "thread local" means process-global class local(object): pass else: try: local = threading.local except AttributeError: # Added in 2.4, but now we'll have to define it ourselves import thread class local(object): def __init__(self): self.__dict__['__objs'] = {} def __getattr__(self, attr, g=thread.get_ident): try: return self.__dict__['__objs'][g()][attr] except KeyError: raise AttributeError( "No variable %s defined for the thread %s" % (attr, g())) def __setattr__(self, attr, value, g=thread.get_ident): self.__dict__['__objs'].setdefault(g(), {})[attr] = value def __delattr__(self, attr, g=thread.get_ident): try: del self.__dict__['__objs'][g()][attr] except KeyError: raise AttributeError( "No variable %s defined for thread %s" % (attr, g())) PK j6\'UU!paste/deploy/util/fixtypeerror.py# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """ Fixes the vague error message that you get when calling a function with the wrong arguments. """ import inspect import sys def fix_type_error(exc_info, callable, varargs, kwargs): """ Given an exception, this will test if the exception was due to a signature error, and annotate the error with better information if so. Usage:: try: val = callable(*args, **kw) except TypeError: exc_info = fix_type_error(None, callable, args, kw) raise exc_info[0], exc_info[1], exc_info[2] """ if exc_info is None: exc_info = sys.exc_info() if (exc_info[0] != TypeError or str(exc_info[1]).find('arguments') == -1 or getattr(exc_info[1], '_type_error_fixed', False)): return exc_info exc_info[1]._type_error_fixed = True import inspect argspec = inspect.formatargspec(*inspect.getargspec(callable)) args = ', '.join(map(_short_repr, varargs)) if kwargs and args: args += ', ' if kwargs: kwargs = kwargs.items() kwargs.sort() args += ', '.join(['%s=...' % n for n, v in kwargs]) gotspec = '(%s)' % args msg = '%s; got %s, wanted %s' % (exc_info[1], gotspec, argspec) exc_info[1].args = (msg,) return exc_info def _short_repr(v): v = repr(v) if len(v) > 12: v = v[:8]+'...'+v[-4:] return v def fix_call(callable, *args, **kw): """ Call ``callable(*args, **kw)`` fixing any type errors that come out. """ try: val = callable(*args, **kw) except TypeError: exc_info = fix_type_error(None, callable, args, kw) raise exc_info[0], exc_info[1], exc_info[2] return val PK.68fޗp p "paste/deploy/util/fixtypeerror.pyc; IFc@s7dZdkZdkZdZdZdZdS(s^ Fixes the vague error message that you get when calling a function with the wrong arguments. Nc Csg|tjoti}n|dtjp4t|diddjpt|ddto|Snt|d_ dk }|i |i |}ditt|}|o|o|d7}n|oX|i}|i|digi} |D]\}}| d|q~ 7}nd |} d |d| |f} | f|d_|SdS( sh Given an exception, this will test if the exception was due to a signature error, and annotate the error with better information if so. Usage:: try: val = callable(*args, **kw) except TypeError: exc_info = fix_type_error(None, callable, args, kw) raise exc_info[0], exc_info[1], exc_info[2] iis argumentsis_type_error_fixedNs, s%s=...s(%s)s%s; got %s, wanted %s(sexc_infosNonessyss TypeErrorsstrsfindsgetattrsFalsesTrues_type_error_fixedsinspects formatargspecs getargspecscallablesargspecsjoinsmaps _short_reprsvarargssargsskwargssitemsssortsappends_[1]snsvsgotspecsmsg( sexc_infoscallablesvarargsskwargssinspectsargssvsargspecsnsmsgsgotspecs_[1]((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pysfix_type_error s&  H    B cCsAt|}t|djo|d d|d}n|SdS(Ni is...i(sreprsvslen(sv((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pys _short_repr-s cOs^y|||}Wn@tj o4tt|||}|d|d|dnX|SdS(sR Call ``callable(*args, **kw)`` fixing any type errors that come out. iiiN(scallablesargsskwsvals TypeErrorsfix_type_errorsNonesexc_info(scallablesargsskwsvalsexc_info((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pysfix_call3s(s__doc__sinspectssyssfix_type_errors _short_reprsfix_call(ssyssfix_type_errorsinspectsfix_calls _short_repr((sBbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/fixtypeerror.pys?s    # PK.68|paste/deploy/util/__init__.pyo; IFc@sdS(N((((s>build/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/__init__.pys?sPK.68|lOuu$paste/deploy/util/threadinglocal.pyo; IFc@sy dkZWn)ej odefdYZnDXy eiZWn2ej o&dkZdefdYZnXdS(NslocalcBstZRS(N(s__name__s __module__(((sDbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/threadinglocal.pyslocalscBs>tZdZeidZeidZeidZRS(NcCsh|idbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/__init__.pys?sPK.68|lOuu$paste/deploy/util/threadinglocal.pyc; IFc@sy dkZWn)ej odefdYZnDXy eiZWn2ej o&dkZdefdYZnXdS(NslocalcBstZRS(N(s__name__s __module__(((sDbuild/bdist.darwin-8.0.1-x86/egg/paste/deploy/util/threadinglocal.pyslocalscBs>tZdZeidZeidZeidZRS(NcCsh|id`_ provides commands to serve applications based on this configuration file. The latest version is available in a `Subversion repository `_. For the latest changes see the `news file `_. Keywords: web wsgi application server Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: Programming Language :: Python Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Internet :: WWW/HTTP :: WSGI Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware Classifier: Framework :: Paste PK.68U4sEGG-INFO/requires.txt [Paste] Paste [Config] PK.68KEGG-INFO/top_level.txtpaste PKj62EGG-INFO/not-zip-safe PK j60paste/__init__.pyPK.68/2P$paste/__init__.pyoPK.68/2PQpaste/__init__.pycPK.68&i ~paste/deploy/epdesc.pyoPK j6j>QbbWpaste/deploy/__init__.pyPK.689MI3I3paste/deploy/config.pycPK.68&i mGpaste/deploy/epdesc.pycPK.68-,ڝ&&FSpaste/deploy/interfaces.pyoPK.68I%  !Yzpaste/deploy/paster_templates.pycPK j6 __paste/deploy/converters.pyPK.68mD8paste/deploy/__init__.pyoPK j6] paste/deploy/paster_templates.pyPK j6XXpaste/deploy/loadwsgi.pyPK.68I%  !paste/deploy/paster_templates.pyoPK j6* paste/deploy/interfaces.pyPK.68CCpaste/deploy/converters.pycPK.68>$brrpaste/deploy/loadwsgi.pyoPK.689MI3I3xpaste/deploy/config.pyoPK j6%4))hpaste/deploy/config.pyPK.68CC,paste/deploy/converters.pyoPK.68-,ڝ&&Mpaste/deploy/interfaces.pycPK.68 tt`paste/deploy/loadwsgi.pycPK.68mDvpaste/deploy/__init__.pycPK j6َQ  wpaste/deploy/epdesc.pyPK j67E)}paste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmplPK j6]Dipaste/deploy/paster_templates/paste_deploy/+package+/wsgiapp.py_tmplPK j6)|  Fpaste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmplPK j6U60paste/deploy/util/__init__.pyPK.68fޗp p "paste/deploy/util/fixtypeerror.pyoPK j64YY#Ƒpaste/deploy/util/threadinglocal.pyPK j6\'UU!`paste/deploy/util/fixtypeerror.pyPK.68fޗp p "paste/deploy/util/fixtypeerror.pycPK.68|paste/deploy/util/__init__.pyoPK.68|lOuu$npaste/deploy/util/threadinglocal.pyoPK.68|%paste/deploy/util/__init__.pycPK.68|lOuu$paste/deploy/util/threadinglocal.pycPK.68KEGG-INFO/namespace_packages.txtPK.681uuEGG-INFO/SOURCES.txtPK.683 EGG-INFO/entry_points.txtPK.682EGG-INFO/dependency_links.txtPK.68tnN"EGG-INFO/PKG-INFOPK.68U4sEGG-INFO/requires.txtPK.68KEGG-INFO/top_level.txtPKj62WEGG-INFO/not-zip-safePK,,