Skip to content

Commit

Permalink
Merge pull request #53 from vinnyrose/setup_lazy_indexes
Browse files Browse the repository at this point in the history
Defining _setup_lazy_indexes.
  • Loading branch information
vdboor committed Jan 14, 2015
2 parents 0defdfc + fa972bc commit 030e08e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fluent_pages/extensions/pagetypepool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fluent_pages.models import UrlNode
from fluent_utils.load import import_apps_submodule
from .pagetypebase import PageTypePlugin
from six import itervalues
from six import itervalues, iteritems


__all__ = (
Expand Down Expand Up @@ -134,6 +134,13 @@ def _get_plugin_by_content_type(self, contenttype):
return self.plugins[name]


def _setup_lazy_indexes(self):
if self._name_for_ctype_id is None:
self._name_for_ctype_id = {}
for name, plugin_instance in iteritems(self.plugins):
self._name_for_ctype_id[plugin_instance.type_id] = name


def get_file_types(self):
"""
Return the :class:`~django.contrib.contenttypes.models.ContentType` id's
Expand Down

0 comments on commit 030e08e

Please sign in to comment.