I had the question,
What do you mean by "compiling" tag libraries?
I mean, that Spyce compiles that chatbox.spy into in a more-or-less 1.3-legal python module. (The classcode/handlers/exports features aren't in 1.3, but you get the idea.) The compiled result looks like this (output courtesy of the Spyce -c option):
class boxlet(spyceTagPlus):
name='boxlet'
buffer=False
exports=1
classcode=((7,4),(10,83),"def addLine(self):\n # (use get() in case server restarted)\n request._api.getServerGlobals().get('chatlines', []).append(request['newline'])",'test-chatbox.spy')
handlers=[('e73068ffe2d1ead1793b6790ec48f92a04fd18641','self.addLine')]
def syntax(self):
self.syntaxSingleOnly()
def begin(self,width='300',lines='5'):
pool=self._api._startModule('pool',None,None)
taglib=self._api.getModules()['taglib']
taglib.load('form','form.py','f')
self._out.writeStatic('\n\n')
pool.init()
self._out.writeStatic('\n<div width="')
self._out.writeExpr(width)
self._out.writeStatic('">\n')
i=-int(lines)
line=None# for first export
for line in pool.setdefault('chatlines',[])[i:]:
self._out.writeStatic(' <div>')
self._out.writeExpr(line)
self._out.writeStatic('</div>\n')
self._out.writeStatic(' <div>\n <f:text name=newline />')
taglib.tagPush('f','text',locals(),{'name':'newline'},False)
try:
taglib.tagBegin()
taglib.tagBody()
taglib.tagEnd()
finally:taglib.tagPop()
self._out.writeStatic('\n <f:submit handler=\'self.addLine\' value="Send" />')
taglib.tagPush('f','submit',locals(),{'_handlerid':'e73068ffe2d1ead1793b6790ec48f92a04fd18641','value':'Send'},False)
try:
taglib.tagBegin()
taglib.tagBody()
taglib.tagEnd()
finally:taglib.tagPop()
self._out.writeStatic('\n <f:submit value="Refresh" />')
taglib.tagPush('f','submit',locals(),{'_handlerid':'e73068ffe2d1ead1793b6790ec48f92a04fd18642','value':'Refresh'},False)
try:
taglib.tagBegin()
taglib.tagBody()
taglib.tagEnd()
finally:taglib.tagPop()
self._out.writeStatic('\n </div>\n</div>\n\n')
self.line=line
def export(self):
return{'last':self.line}
class spyceTagcollection(spyceTagLibrary):
tags=[boxlet]
You can see why not many of these got written. :)
Comments
Does Blogger have that as an option?