Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.i18n.normalizer.adapters.UserPreferredURLNormalizer Class Reference

List of all members.

Public Member Functions

def __init__
def normalize

Public Attributes

 context

Detailed Description

An adapter for the HTTPRequest to provide user preferred language
dependent normalization.

Let's make sure that this implementation actually fulfills the API.

  >>> from zope.interface.verify import verifyClass
  >>> verifyClass(IUserPreferredURLNormalizer, UserPreferredURLNormalizer)
  True

Definition at line 38 of file adapters.py.


Constructor & Destructor Documentation

Definition at line 51 of file adapters.py.

00051 
00052     def __init__(self, context):
00053         self.context = context # the context must be the request

Here is the caller graph for this function:


Member Function Documentation

Returns a normalized Unicode string.

Definition at line 54 of file adapters.py.

00054 
00055     def normalize(self, text):
00056         """Returns a normalized Unicode string."""
00057         locale = None
00058         langs = IUserPreferredLanguages(self.context).getPreferredLanguages()
00059         if langs:
00060             locale = langs[0]
00061 
00062         util = queryUtility(IURLNormalizer)
00063         return util.normalize(text, locale=locale)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 52 of file adapters.py.


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