Back to index

plone3  3.1.7
Public Member Functions
plone.app.layout.globals.portal.PortalState Class Reference
Inheritance diagram for plone.app.layout.globals.portal.PortalState:
Inheritance graph
[legend]
Collaboration diagram for plone.app.layout.globals.portal.PortalState:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def portal
def portal_title
def portal_url
def navigation_root_path
def navigation_root_url
def default_language
def language
def locale
def is_rtl
def member
def anonymous
def friendly_types

Detailed Description

Information about the state of the portal

Definition at line 15 of file portal.py.


Member Function Documentation

Definition at line 101 of file portal.py.

00101 
00102     def anonymous(self):
00103         context = aq_inner(self.context)
00104         tool = getToolByName(context, "portal_membership")
00105         return bool(tool.isAnonymousUser())

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 43 of file portal.py.

00043 
00044     def default_language(self):
00045         context = aq_inner(self.context)
00046         site_properties = getToolByName(context, "portal_properties").site_properties
00047         return site_properties.getProperty('default_language', None)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 107 of file portal.py.

00107 
00108     def friendly_types(self):
00109         context = aq_inner(self.context)
00110         site_properties = getToolByName(context, "portal_properties").site_properties
00111         not_searched = site_properties.getProperty('types_not_searched', [])
00112 
00113         types = getToolByName(context, "portal_types").listContentTypes()
00114         return [t for t in types if t not in not_searched]

Here is the call graph for this function:

Definition at line 82 of file portal.py.

00082 
00083     def is_rtl(self):
00084         _locale = self.locale()
00085         if _locale is None:
00086             # We cannot determine the orientation
00087             return False
00088 
00089         char_orient = _locale.orientation.characters
00090         if char_orient == u'right-to-left':
00091             return True
00092 
00093         return False

Here is the call graph for this function:

Definition at line 49 of file portal.py.

00049 
00050     def language(self):
00051         # TODO Looking for lower-case language is wrong, the negotiator
00052         # machinery uses uppercase LANGUAGE. We cannot change this as long
00053         # as we don't ship with a newer PloneLanguageTool which respects
00054         # the content language, though.
00055         return self.request.get('language', None) or \
00056                 aq_inner(self.context).Language() or self.default_language()

Here is the call graph for this function:

Definition at line 58 of file portal.py.

00058 
00059     def locale(self):
00060         # This code was adopted from zope.publisher.http.setupLocale
00061         envadapter = IUserPreferredLanguages(self.request, None)
00062         if envadapter is None:
00063             return None
00064 
00065         _locale = None
00066         langs = envadapter.getPreferredLanguages()
00067         for httplang in langs:
00068             parts = (httplang.split('-') + [None, None])[:3]
00069             try:
00070                 _locale = locales.getLocale(*parts)
00071                 break
00072             except LoadLocaleError:
00073                 # Just try the next combination
00074                 pass
00075         else:
00076             # No combination gave us an existing locale, so use the default,
00077             # which is guaranteed to exist
00078             _locale = locales.getLocale(None, None, None)
00079 
00080         return _locale

Here is the caller graph for this function:

Definition at line 95 of file portal.py.

00095 
00096     def member(self):
00097         context = aq_inner(self.context)
00098         tool = getToolByName(context, "portal_membership")
00099         return tool.getAuthenticatedMember()

Here is the call graph for this function:

Definition at line 34 of file portal.py.

00034 
00035     def navigation_root_path(self):
00036         return getNavigationRoot(aq_inner(self.context))
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 38 of file portal.py.

00038 
00039     def navigation_root_url(self):
00040         rootPath = self.navigation_root_path()
00041         return self.request.physicalPathToURL(rootPath)
    

Here is the call graph for this function:

Definition at line 21 of file portal.py.

00021 
00022     def portal(self):
00023         context = aq_inner(self.context)
00024         return getToolByName(context, 'portal_url').getPortalObject()
    

Here is the call graph for this function:

Definition at line 26 of file portal.py.

00026 
00027     def portal_title(self):
00028         return self.portal().Title()
        

Here is the call graph for this function:

Definition at line 30 of file portal.py.

00030 
00031     def portal_url(self):
00032         return self.portal().absolute_url()
        

Here is the call graph for this function:


The documentation for this class was generated from the following file: