Skip to content

Commit b559777

Browse files
committed
Merge remote-tracking branch 'official/next' into next
* official/next: mention link to compatibility matrix Fix oversight in previous Work around feincms#571 by wrapping the template loader instanciation in a try/except. Note Page.cache_key deprecation.
2 parents 65b054e + 3c0f72b commit b559777

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎docs/advanced/caching.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ of helper methods and variables, ready to be used in your templates.
3131

3232
Here's an (incomplete) list of variables to use in {% cache %} blocks [#djangocache]_:
3333

34-
* feincms_page.cache_key -- a string describing the current page.
34+
* feincms_page.cache_key -- DEPRECATED as of FeinCMS 1.11.
35+
A string describing the current page.
3536
Depending on the extensions loaded, this varies with the page,
3637
the page's modification date, its language, etc. This is always
3738
a safe bet to use on page specific fragments.

‎docs/faq.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ You can either remove the line ``Page.register_extensions(...)`` from
4848
your code or drop the page_page table and re-run ``syncdb``. If you want
4949
to keep the pages you've already created, you need to figure out the
5050
correct ALTER TABLE statements for your database yourself.
51+
52+
53+
54+
Is FeinCMS version X compatible with Django version Y?
55+
======================================================
56+
57+
Check out the compatibility matrix `here <https://docs.google.com/spreadsheets/d/1w1Gix3q4pNtyBJ0RwNOPpLQpEakvxxChadv3LK_Uy70/edit?usp=sharing>`_.

‎feincms/content/template/models.py‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,31 @@ class Meta:
5353
verbose_name = _('template content')
5454
verbose_name_plural = _('template contents')
5555

56+
template_loaders = []
57+
5658
@classmethod
57-
def initialize_type(cls, TEMPLATE_LOADERS=DEFAULT_TEMPLATE_LOADERS):
58-
cls.template_loaders = [
59-
find_template_loader(loader)
60-
for loader in TEMPLATE_LOADERS if loader]
59+
def initialize_type(cls, TEMPLATE_LOADERS=DEFAULT_TEMPLATE_LOADERS,
60+
TEMPLATE_PATH='content/template'):
61+
cls.template_path = TEMPLATE_PATH
62+
for loader in TEMPLATE_LOADERS:
63+
if loader:
64+
# With Django 1.6 find_template_loader blows up during
65+
# syncdb, probably because component initialization order
66+
# has changed. Work around by ignoring exceptions here,
67+
# but of course, this will also swallow legitimate
68+
# exceptions. Tough luck :-(
69+
try:
70+
cls.template_loaders.append(find_template_loader(loader))
71+
except Exception:
72+
pass
6173

6274
cls.add_to_class('filename', models.CharField(
6375
_('template'), max_length=100,
6476
choices=TemplateChoices(cls.template_loaders)))
6577

6678
def render(self, **kwargs):
6779
context = kwargs.pop('context', None)
68-
name = 'content/template/%s' % self.filename
80+
name = os.path.join(self.template_path, self.filename)
6981

7082
for loader in self.template_loaders:
7183
try:

0 commit comments

Comments
 (0)