Back to index

plone3  3.1.7
Classes | Functions
CMFPlone.patches.unicodehacks Namespace Reference

Classes

class  FasterStringIO

Functions

def _unicode_replace
def _nulljoin
def new__call__

Function Documentation

def CMFPlone.patches.unicodehacks._nulljoin (   valuelist) [private]

Definition at line 26 of file unicodehacks.py.

00026 
00027 def _nulljoin(valuelist):
00028     try:
00029         return u''.join(valuelist)
00030     except UnicodeDecodeError:
00031         pass
00032     return u''.join([_unicode_replace(value) for value in valuelist])
00033 

Here is the call graph for this function:

def CMFPlone.patches.unicodehacks._unicode_replace (   structure) [private]

Definition at line 6 of file unicodehacks.py.

00006 
00007 def _unicode_replace(structure):
00008     if isinstance(structure, str):
00009         try:
00010             text = structure.decode('utf-8')
00011         except UnicodeDecodeError:
00012             # XXX Maybe, raise an exception here instead of a warning?
00013             warnings.warn(textwrap.dedent('''\
00014 
00015             *** *** Insertion of non-unicode non-ascii non-utf8 encoded text in TAL is deprecated and will be broken in Plone 4.0 !!!
00016 
00017             %s...
00018             ''' % (repr(structure), )), DeprecationWarning, 2)
00019             # XXX the next line is fool-proof and will substitute ??-s if the encoding was not
00020             # unicode
00021             text = structure.decode('utf-8', 'replace')
00022     else:
00023         text = unicode(structure)
00024     return text
00025 

Here is the caller graph for this function:

def CMFPlone.patches.unicodehacks.new__call__ (   self,
  econtext 
)

Definition at line 34 of file unicodehacks.py.

00034 
00035 def new__call__(self, econtext):
00036     try:
00037         return self._expr % tuple([var(econtext) for var in self._vars])
00038     except UnicodeDecodeError:
00039         pass
00040     return self._expr % tuple([_unicode_replace(var(econtext)) for var in self._vars])
00041 

Here is the call graph for this function: