Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
PloneLanguageTool.LanguageTool.LanguageBinding Class Reference
Collaboration diagram for PloneLanguageTool.LanguageTool.LanguageBinding:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def setLanguageBindings
def getLanguageBindings

Public Attributes

 tool
 LANGUAGE_LIST

Static Public Attributes

tuple security = ClassSecurityInfo()
 DEFAULT_LANGUAGE = None
 LANGUAGE = None
list LANGUAGE_LIST = []

Static Private Attributes

int __allow_access_to_unprotected_subobjects__ = 1

Detailed Description

Helper which holding language infos in request.

Definition at line 500 of file LanguageTool.py.


Constructor & Destructor Documentation

Definition at line 509 of file LanguageTool.py.

00509 
00510     def __init__(self, tool):
00511         self.tool = tool


Member Function Documentation

Returns the bound languages.

(language, default_language, languages_list)

Definition at line 563 of file LanguageTool.py.

00563 
00564     def getLanguageBindings(self):
00565         """Returns the bound languages.
00566 
00567         (language, default_language, languages_list)
00568         """
00569         return (self.LANGUAGE, self.DEFAULT_LANGUAGE, self.LANGUAGE_LIST)
00570 

def PloneLanguageTool.LanguageTool.LanguageBinding.setLanguageBindings (   self,
  usePath = 1,
  useCookie = 1,
  useRequest = 1,
  useDefault = 1,
  useCcTLD = 0 
)
Setup the current language stuff.

Definition at line 513 of file LanguageTool.py.

00513 
00514     def setLanguageBindings(self, usePath=1, useCookie=1, useRequest=1, useDefault=1, useCcTLD=0):
00515         """Setup the current language stuff."""
00516         langs = []
00517 
00518         if usePath:
00519             # This one is set if there is an allowed language in the current path
00520             langsPath = [self.tool.getPathLanguage()]
00521         else:
00522             langsPath = []
00523 
00524         if useCookie:
00525             # If we are using the cookie stuff we provide the setter here
00526             set_language = self.tool.REQUEST.get('set_language', None)
00527             if set_language:
00528                 langsCookie = [self.tool.setLanguageCookie(set_language)]
00529             else:
00530                 # Get from cookie
00531                 langsCookie = [self.tool.getLanguageCookie()]
00532         else:
00533             langsCookie = []
00534 
00535         if useCcTLD:
00536             langsCcTLD = self.tool.getCcTLDLanguages()
00537         else:
00538             langsCcTLD = []
00539         # Get langs from request
00540         if useRequest:
00541             langsRequest = self.tool.getRequestLanguages()
00542         else:
00543             langsRequest = []
00544 
00545         # Get default
00546         if useDefault:
00547             langsDefault = [self.tool.getDefaultLanguage()]
00548         else:
00549             langsDefault = []
00550 
00551         # Build list
00552         langs = langsPath+langsCookie+langsCcTLD+langsRequest+langsDefault
00553 
00554         # Filter None languages
00555         langs = [lang for lang in langs if lang is not None]
00556 
00557         self.DEFAULT_LANGUAGE = langs[-1]
00558         self.LANGUAGE = langs[0]
00559         self.LANGUAGE_LIST = langs[1:-1]
00560 
00561         return self.LANGUAGE


Member Data Documentation

Definition at line 503 of file LanguageTool.py.

Definition at line 505 of file LanguageTool.py.

Definition at line 506 of file LanguageTool.py.

Definition at line 507 of file LanguageTool.py.

Definition at line 558 of file LanguageTool.py.

tuple PloneLanguageTool.LanguageTool.LanguageBinding.security = ClassSecurityInfo() [static]

Definition at line 502 of file LanguageTool.py.

Definition at line 510 of file LanguageTool.py.


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