Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
PlacelessTranslationService.Negotiator.RequestGetAccept Class Reference

List of all members.

Public Member Functions

def __init__
def getAccepted

Static Public Attributes

tuple filters = (str_lower, lang_normalize, str_strip)

Detailed Description

Definition at line 176 of file Negotiator.py.


Constructor & Destructor Documentation

Definition at line 179 of file Negotiator.py.

00179 
00180     def __init__(self, request):
00181         log('DeprecationWarning: The RequestGetAccept handler is deprecated '
00182             'and will be removed in PTS 1.5.', logging.WARNING)


Member Function Documentation

def PlacelessTranslationService.Negotiator.RequestGetAccept.getAccepted (   self,
  request,
  kind = 'language' 
)

Definition at line 183 of file Negotiator.py.

00183 
00184     def getAccepted(self, request, kind='language'):
00185         # get
00186         form = request.form
00187         language=form.get('language', None)
00188         setLanguage=form.get('setlanguage', None)
00189 
00190         if language:
00191             #filter
00192             for filter in self.filters:
00193                 language = filter(language)
00194             try:
00195                 if setLanguage == 1 or setLanguage.lower() in ('1','true', 'yes'):
00196                     setLanguage = True
00197                 else:
00198                     setLanguage = False
00199             except (ValueError, AttributeError), msg:
00200                 setLanguage = False
00201             if setLanguage:
00202                 setCookieLanguage(request, language)
00203             return (language,)
00204         else:
00205             return ()
00206 
00207 
00208 # higher number = higher priority
00209 # if a acceptor returns a false value (() or None) then the next acceptor
00210 # in the chain is queried
00211 registerLangPrefsMethod({'klass':BrowserAccept,   'priority':10 }, 'language')
00212 registerLangPrefsMethod({'klass':CookieAccept,   'priority':40 }, 'language')
00213 
00214 registerLangPrefsMethod({'klass':BrowserAccept,'priority':10 }, 'content-type')
00215 

Here is the call graph for this function:


Member Data Documentation

Definition at line 177 of file Negotiator.py.


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