Added script eggify.py for wrapping a Python module into an egg, and plenty of minor improvements and refactorings.

This commit is contained in:
Gaetan Delannay 2010-11-26 17:30:46 +01:00
parent aea19a819e
commit 52816ec343
23 changed files with 2048 additions and 1760 deletions

View file

@ -486,11 +486,18 @@ class MemoryBuffer(Buffer):
else:
res = self.getLength()
return res
reTagContent = re.compile('<(?P<p>[\w-]+):(?P<f>[\w-]+)(.*?)>.*</(?P=p):' \
'(?P=f)>', re.S)
def evaluate(self, subElements=True, removeMainElems=False):
#print 'Evaluating buffer', self.content.encode('utf-8'), self.elements
result = self.getFileBuffer()
if not subElements:
result.write(self.content)
# Dump the root tag in this buffer, but not its content.
res = self.reTagContent.match(self.content.strip())
if not res: result.write(self.content)
else:
g = res.group
result.write('<%s:%s%s></%s:%s>' % (g(1),g(2),g(3),g(1),g(2)))
else:
iter = BufferIterator(self)
currentIndex = self.getStartIndex(removeMainElems)
@ -505,8 +512,6 @@ class MemoryBuffer(Buffer):
PodError.dump(result, EVAL_EXPR_ERROR % (
evalEntry.expr, e), dumpTb=False)
else: # It is a subBuffer
#print '******Subbuffer*************'
# This is a bug.
if evalEntry.action:
evalEntry.action.execute()
else: