Not sure how much speed is a concern, but the StaticViewPredicate here:
class StaticViewPredicate(object):
def __init__(self, package, subdir):
self.package = package
self.subdir = subdir
def __call__(self, info, request):
import logging
log = logging.getLogger(__name__)
log.setLevel(0)
subpath = info["match"]["subpath"]
log.debug("subpath is %r", subpath)
if not subpath:
log.debug("no subpath, returning false")
return False
parts = [self.subdir]
parts.extend(subpath)
resource_name = "/".join(parts)
log.debug("package=%r, resource_name=%r", self.package,
resource_name)
return pkg_resources.resource_exists(self.package,
resource_name)
.. could be sped up. Since this predicate will be called many, many
times (at least once for each request), it might be wise to:
- Import logging at module scope, create a logger at module scope, set
level at module scope.
or better..
- Don't log here. Logging is very expensive.
Also, FWIW, I'd (reverting my prior arguments to the contrary, which I
already did here:
https://github.com/Pylons/pyramid/issues/closed#issue/44) consider
making modules a package if the config.scan() hack (as documented here:
http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/sqla.html)
was injected into the paster template to cause all models to be imported
without needing a meta.py and all that stuff.
- C
On Wed, 2011-01-26 at 01:55 -0800, Mike Orr wrote:
> pyramid_sqla is now in release candidate status. If I don't hear of
> any bugs over the next week I'll release the final.
>
> 1.0rc1 (2010-01-26)
>
> * ‘pyramid_sqla’ application template supports commit veto feature
> in repoze.tm2 1.0b1.
> * Add production.ini to application template.
> * Delete stray files in application template that were
> accidentally included.
>
> Download: http://pypi.python.org/pypi/pyramid_sqla
> Documentation:
> https://bytebucket.org/sluggo/pyramid_sqla/wiki/html/index.html
> Source: http://bitbucket.org/sluggo/pyramid_sqla
>
> (The documentation link is lagging behind; I'm not sure if it's
> bitbucket caching. If it still says version 0.2, see the docs in the
> source:
> https://bitbucket.org/sluggo/pyramid_sqla/src/be8422f121b7/docs/
>
>
> Important note for version 0.1 users:
>
> Pyramid 1.0a10 made an incompatible change for applications created
> with pyramid_sqla 0.1. To use these applications with Pyramid 1.0a10
> or later, edit the applications’ setup.py and add ‘pyramid_handlers’
> to the ‘requires’ list, and reinstall the applications.
>
>
> --
> Mike Orr <[email protected]>
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.