Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 from zope.interface import Interface
00002 
00003 class INormalizer(Interface):
00004     """A normalizer can normalize any unicode text string according to a
00005        specific ruleset implemented in the normalizer itself.
00006     """
00007 
00008     def normalize(text, locale=None, max_length=None):
00009         """The normalize method takes and input unicode text and an optional
00010            locale string and returns a normalized version of the text.
00011            If the locale is not None the ouput might differ dependent on the
00012            locale. The max_length argument allows you to override the default
00013            values used by the normalizers on a case-by-case basis.
00014         """
00015 
00016 class IIDNormalizer(INormalizer):
00017     """An ID normalizer can normalize any unicode string and returns a
00018        version that only contains of ASCII characters allowed in a typical
00019        scripting or programming language id, such as CSS class names or Python
00020        variable names for example.
00021     """
00022 
00023 class IFileNameNormalizer(INormalizer):
00024     """An file name normalizer can normalize any unicode string and returns a
00025        version that only contains of ASCII characters allowed in a URL while
00026        still preserving whitespace and upper and lower case.
00027     """
00028 
00029 class IURLNormalizer(INormalizer):
00030     """An URL normalizer can normalize any unicode string and returns a
00031        URL-safe version that only contains of ASCII characters allowed in a URL.
00032     """
00033 
00034 class IUserPreferredNormalizer(Interface):
00035     """An adapter for the HTTPRequest to provide user preferred language
00036        dependent normalization.
00037     """
00038 
00039     def normalize(text):
00040         """Returns a normalized Unicode string."""
00041 
00042 class IUserPreferredFileNameNormalizer(IUserPreferredNormalizer):
00043     """An adapter for the HTTPRequest to provide user preferred language
00044        dependent normalization, based on an file name normalizer.
00045     """
00046 
00047 class IUserPreferredURLNormalizer(IUserPreferredNormalizer):
00048     """An adapter for the HTTPRequest to provide user preferred language
00049        dependent normalization, based on an URL normalizer.
00050     """