Back to index

plone3  3.1.7
Functions
plone.app.portlets.cache Namespace Reference

Functions

def get_language
def render_cachekey

Function Documentation

def plone.app.portlets.cache.get_language (   context,
  request 
)

Definition at line 5 of file cache.py.

00005 
00006 def get_language(context, request):
00007     portal_state = component.getMultiAdapter(
00008         (context, request), name=u'plone_portal_state')
00009     return portal_state.locale().getLocaleID()

Here is the caller graph for this function:

def plone.app.portlets.cache.render_cachekey (   fun,
  self 
)
Generates a key based on:

* Portal URL
* Negotiated language
* Anonymous user flag
* Portlet manager
* Assignment
* Fingerprint of the data used by the portlet

Definition at line 10 of file cache.py.

00010 
00011 def render_cachekey(fun, self):
00012     """
00013     Generates a key based on:
00014 
00015     * Portal URL
00016     * Negotiated language
00017     * Anonymous user flag
00018     * Portlet manager
00019     * Assignment
00020     * Fingerprint of the data used by the portlet
00021     
00022     """
00023     context = aq_inner(self.context)
00024     
00025     def add(brain):
00026         path = brain.getPath().decode('ascii', 'replace')
00027         return "%s\n%s\n\n" % (path, brain.modified)
00028     fingerprint = "".join(map(add, self._data()))
00029 
00030     anonymous = getToolByName(context, 'portal_membership').isAnonymousUser()
00031 
00032     return "".join((
00033         getToolByName(aq_inner(self.context), 'portal_url')(),
00034         get_language(aq_inner(self.context), self.request),
00035         str(anonymous),
00036         self.manager.__name__,
00037         self.data.__name__,
00038         fingerprint))

Here is the call graph for this function: