Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Remove dependency on zope.cachedescriptors.

Looks like I can do the same things with Brownie,
and the syntax is a bit more pleasant. No need to
use both.

Also removed the compressinja dependency since it
is not being used.
  • Loading branch information...
commit ab081ac02489f3d610f815587111af7fbf74ddb3 1 parent ca33a5a
@tylerbutler authored
21 engineer/
@@ -11,9 +11,8 @@
from jinja2 import Environment, FileSystemLoader, FileSystemBytecodeCache
from typogrify.templatetags.jinja2_filters import register
from path import path
-from zope.cachedescriptors import property as zproperty
+from brownie.caching import cached_property
from engineer.cache import SimpleFileCache
-from engineer.enums import Status
from engineer.filters import typogrify_no_widont
from engineer.plugins import get_all_plugin_types
from engineer.util import urljoin, slugify, ensure_exists, wrap_list, update_additive
@@ -283,11 +282,11 @@ def _check_deprecated_settings(self, config):
if config.pop(setting[0], None) is not None:
logger.warning("The '%s' setting was deprecated in version %s: %s" % setting)
- @zproperty.CachedProperty
+ @cached_property
return path(self.OUTPUT_CACHE_DIR / self.ENGINEER.STATIC_DIR.basename()).abspath()
- @zproperty.CachedProperty
+ @cached_property
def JINJA_ENV(self):
from engineer.filters import format_datetime, markdown_filter, localtime, naturaltime, compress
from engineer.processors import preprocess_less
@@ -335,8 +334,14 @@ def urlname(name, *args):
env.globals['settings'] = self
return env
- @zproperty.CachedProperty
+ @cached_property
def CACHE(self):
+ # This check is a hack to ensure sphinx autodoc doesn't choke on this property.
+ # I don't know why it chokes here, but I think the exception handling might be
+ # messing with it.
+ if self is None:
+ return
# Use a shelf as the main cache
CACHE =, writeback=True)
@@ -350,19 +355,19 @@ def CACHE(self):
CACHE['version'] = version
return CACHE
- @zproperty.CachedProperty
+ @cached_property
if not self.CACHE.has_key('COMPRESSION_CACHE'):
self.CACHE['COMPRESSION_CACHE'] = SimpleFileCache(version=version)
- @zproperty.CachedProperty
+ @cached_property
def POST_CACHE(self):
if not self.CACHE.has_key('POST_CACHE'):
self.CACHE['POST_CACHE'] = SimpleFileCache(version=version)
return self.CACHE['POST_CACHE']
- @zproperty.CachedProperty
+ @cached_property
def LESS_CACHE(self):
if not self.CACHE.has_key('LESS_CACHE'):
self.CACHE['LESS_CACHE'] = SimpleFileCache(version=version)
2  engineer/docs_source/
@@ -58,7 +58,7 @@
# General information about the project.
project = APP_NAME
-copyright = u'2011, %s' % AUTHOR_NAME
+copyright = u'2011-2012, %s' % AUTHOR_NAME
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
2  engineer/docs_source/intro.rst
@@ -134,11 +134,9 @@ complete set of packages Engineer depends on is as follows:
* flufl.enum
* translitcodec
* jinja2
-* compressinja
* pygments
* html5lib
* python-dateutil
-* zope.cachedescriptors
* humanize
* bottle
* pytz
2  engineer/
@@ -1,5 +1,5 @@
# coding=utf-8
-import sys, platform
+import sys
import logging
from brownie.caching import memoize
from engineer.lib.ansistrm import ColorizingStreamHandler
18 engineer/
@@ -7,12 +7,12 @@
from codecs import open
from copy import copy
from datetime import datetime
+from brownie.caching import cached_property
from dateutil import parser
from path import path
from propane.datastructures import CaseInsensitiveDict
from typogrify.templatetags.jinja2_filters import typogrify
from yaml.scanner import ScannerError
-from import CachedProperty
from engineer.conf import settings
from engineer.enums import Status
from engineer.exceptions import PostMetadataError
@@ -149,7 +149,7 @@ def __init__(self, source):
# update cache
settings.POST_CACHE[self.source] = self
- @CachedProperty
+ @cached_property
def url(self):
"""The site-relative URL to the post."""
url = u'{home_url}{permalink}'.format(home_url=settings.HOME_URL,
@@ -157,19 +157,19 @@ def url(self):
url = re.sub(r'/{2,}', r'/', url)
return url
- @CachedProperty
+ @cached_property
def absolute_url(self):
"""The absolute URL to the post."""
return u'{0}{1}'.format(settings.SITE_URL, self.url)
- @CachedProperty
+ @cached_property
def output_path(self):
url = self._permalink
if url.endswith('/'):
url += 'index.html'
return path(settings.OUTPUT_CACHE_DIR / url)
- @CachedProperty
+ @cached_property
def output_file_name(self):
r =
return r
@@ -283,12 +283,12 @@ def paginate(self, paginate_by=None):
paginate_by = settings.ROLLUP_PAGE_SIZE
return chunk(self, paginate_by, PostCollection)
- @CachedProperty
+ @cached_property
def published(self):
"""Returns a new PostCollection containing the subset of posts that are published."""
return PostCollection([p for p in self if p.is_published == True])
- @CachedProperty
+ @cached_property
def drafts(self):
"""Returns a new PostCollection containing the subset of posts that are drafts."""
return PostCollection([p for p in self if p.is_draft == True])
@@ -298,12 +298,12 @@ def pending(self):
"""Returns a new PostCollection containing the subset of posts that are pending."""
return PostCollection([p for p in self if p.is_pending == True])
- @CachedProperty
+ @cached_property
def review(self):
"""Returns a new PostCollection containing the subset of posts whose status is :attr:``."""
return PostCollection([p for p in self if p.status ==])
- @CachedProperty
+ @cached_property
def all_tags(self):
"""Returns a list of all the unique tags, as strings, that posts in the collection have."""
tags = set()
10 engineer/
@@ -1,8 +1,8 @@
# coding=utf-8
from jinja2.loaders import FileSystemLoader
import yaml
+from brownie.caching import memoize
from path import path
-from zope.cachedescriptors import method
from engineer.conf import settings
from engineer.exceptions import ThemeNotFoundException
from engineer.util import get_class
@@ -90,7 +90,7 @@ def __unicode__(self):
class ThemeManager(object):
- @method.cachedIn('_cache')
+ @memoize
def themes(cls):
themes = []
for f in settings.THEME_FINDERS:
@@ -99,7 +99,7 @@ def themes(cls):
return dict([, t] for t in themes)
- @method.cachedIn('_cache')
+ @memoize
def current_theme(cls):
theme = ThemeManager.themes().get(settings.THEME, None)
if theme is not None:
@@ -108,12 +108,12 @@ def current_theme(cls):
raise ThemeNotFoundException("Theme with id '%s' cannot be found." % settings.THEME)
- @method.cachedIn('_cache')
+ @memoize
def theme_path(template):
return path(ThemeManager.current_theme().template_root) / template
- @method.cachedIn('_cache')
+ @memoize
def theme(id):
if id not in ThemeManager.themes():
raise ThemeNotFoundException("Theme with id '%s' cannot be found." % settings.THEME)
2  requirements.txt
@@ -4,11 +4,9 @@ pyYAML>=3.10
Please sign in to comment.
Something went wrong with that request. Please try again.