Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
makepox.POX Class Reference

List of all members.

Public Member Functions

def __init__
def add
def get_result

Public Attributes

 doc
 root
 processed

Detailed Description

container for the results

Definition at line 17 of file makepox.py.


Constructor & Destructor Documentation

def makepox.POX.__init__ (   self)

Definition at line 19 of file makepox.py.

00019 
00020     def __init__(self):
00021         impl = getDOMImplementation()
00022         self.doc = impl.createDocument(None, 'catalog', None)
00023         self.root = self.doc.documentElement
00024         self.processed = {} # mapping from mid to ([filenames], node)


Member Function Documentation

def makepox.POX.add (   self,
  msgid,
  filename 
)

Definition at line 25 of file makepox.py.

00025 
00026     def add(self, msgid, filename):
00027         # strip and reduce whitespace
00028         msgid = msgid.strip().replace('\n', ' ').replace('\t', ' ')
00029         while msgid.find('  ') > -1:
00030             msgid.replace('  ', ' ')
00031         if self.processed.has_key(msgid):
00032             filenames, node = self.processed[msgid]
00033             if not filename in filenames:
00034                 filenames.append(filename)
00035                 node.setAttribute('filenames', 
00036                     '%s %s' % (node.getAttribute('filenames'), filename))
00037             return
00038         doc = self.doc
00039         root = self.root
00040         # add the nodes
00041         msgnode = doc.createElement('message')
00042         msgnode.setAttribute('filenames', filename)
00043         root.appendChild(msgnode)
00044         msgidnode = doc.createElement('msgid')
00045         msgidnode.appendChild(doc.createTextNode(msgid))
00046         msgnode.appendChild(msgidnode)
00047         msgstrnode = doc.createElement('msgstr')
00048         msgstrnode.appendChild(doc.createTextNode(msgid))
00049         msgnode.appendChild(msgstrnode)
00050         msgstrnode.setAttribute('i18n:translate', '')
00051         root.appendChild(msgnode)
00052         self.processed[msgid] = ([filename], msgnode)

Here is the caller graph for this function:

def makepox.POX.get_result (   self)

Definition at line 53 of file makepox.py.

00053 
00054     def get_result(self):
00055         return self.doc.toprettyxml()


Member Data Documentation

Definition at line 21 of file makepox.py.

Definition at line 23 of file makepox.py.

Definition at line 22 of file makepox.py.


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