Back to index

plone3  3.1.7
Namespaces | Classes | Functions | Variables
plone.i18n.normalizer Namespace Reference

Namespaces

namespace  adapters
namespace  base
namespace  de
namespace  el
namespace  fr
namespace  interfaces
namespace  pl
namespace  ru
namespace  tests
namespace  tr

Classes

class  IDNormalizer
class  FileNameNormalizer
class  URLNormalizer

Functions

def cropName

Variables

tuple FILENAME_REGEX = re.compile(r"^(.+)\.(\w{,4})$")
tuple IGNORE_REGEX = re.compile(r"['\"]")
tuple NON_WORD_REGEX = re.compile(r"[\W\-]+")
tuple DANGEROUS_CHARS_REGEX = re.compile(r"[!$%&()*+,/:;<=>?@\\^{|}\[\]~`]+")
tuple URL_DANGEROUS_CHARS_REGEX = re.compile(r"[!#$%&()*+,/:;<=>?@\\^{|}\[\]~`]+")
tuple MULTIPLE_DASHES_REGEX = re.compile(r"\-+")
tuple EXTRA_DASHES_REGEX = re.compile(r"(^\-+)|(\-+$)")
int MAX_LENGTH = 50
int MAX_FILENAME_LENGTH = 1023
int MAX_URL_LENGTH = 255
tuple idnormalizer = IDNormalizer()
tuple filenamenormalizer = FileNameNormalizer()
tuple urlnormalizer = URLNormalizer()

Function Documentation

def plone.i18n.normalizer.cropName (   base,
  maxLength = MAX_LENGTH 
)

Definition at line 25 of file __init__.py.

00025 
00026 def cropName(base, maxLength=MAX_LENGTH):
00027     baseLength = len(base)
00028 
00029     index = baseLength
00030     while index > maxLength:
00031         index = base.rfind('-', 0, index)
00032 
00033     if index == -1 and baseLength > maxLength:
00034         base = base[:maxLength]
00035 
00036     elif index > 0:
00037         base = base[:index]
00038 
00039     return base
00040 

Here is the caller graph for this function:


Variable Documentation

tuple plone.i18n.normalizer.DANGEROUS_CHARS_REGEX = re.compile(r"[!$%&()*+,/:;<=>?@\\^{|}\[\]~`]+")

Definition at line 15 of file __init__.py.

tuple plone.i18n.normalizer.EXTRA_DASHES_REGEX = re.compile(r"(^\-+)|(\-+$)")

Definition at line 18 of file __init__.py.

tuple plone.i18n.normalizer.FILENAME_REGEX = re.compile(r"^(.+)\.(\w{,4})$")

Definition at line 12 of file __init__.py.

Definition at line 202 of file __init__.py.

Definition at line 201 of file __init__.py.

tuple plone.i18n.normalizer.IGNORE_REGEX = re.compile(r"['\"]")

Definition at line 13 of file __init__.py.

Definition at line 21 of file __init__.py.

Definition at line 20 of file __init__.py.

Definition at line 22 of file __init__.py.

tuple plone.i18n.normalizer.MULTIPLE_DASHES_REGEX = re.compile(r"\-+")

Definition at line 17 of file __init__.py.

tuple plone.i18n.normalizer.NON_WORD_REGEX = re.compile(r"[\W\-]+")

Definition at line 14 of file __init__.py.

tuple plone.i18n.normalizer.URL_DANGEROUS_CHARS_REGEX = re.compile(r"[!#$%&()*+,/:;<=>?@\\^{|}\[\]~`]+")

Definition at line 16 of file __init__.py.

Definition at line 203 of file __init__.py.