I've written my own serializer, which I've stored locally under
modules.

I've imported the serializer in my controller with the statement

  module=local_import('serializer') # note: the v3 doc does not
include quotes around the name of the module

So far, so good. However, the serializer uses regular expressions, so
I do an import re within the serializer:

def my_dummy_serializer(text,tag=None,attr={}):
  import re # this is throwing a ticket!
  if tag==None: return re.sub('\s+',' ',text)
  if tag=='br': return '\n\n'
  if tag=='h1': return text
  if tag=='h2': return text
  if tag=='h3': return text
  if tag=='h4': return text
  if tag=='p': return text
  if tag=='b' or tag=='strong': return text
  if tag=='em' or tag=='i': return text
  if tag=='tt' or tag=='code': return text
  if tag=='a': return text
  if tag=='img': return text
  return text

The import re throws a ticket:

NameError: global name 're' is not defined

Suggestions?

Reply via email to