On Mon, 2005-06-13 at 16:50 -0700, Donovan Preston wrote:
On Jun 11, 2005, at 1:37 AM, Cliff Wells wrote:
you have more Python code than your PHP code, but that's because you check for more and it has more capability.
Well, to be sure, I'd rather write 10 lines of Python than 5 lines of PHP anyway ;)
However, here are a few suggestions:
if os.path.exists(filename): fragClass = rend.Fragment fragClass.docFactory = loaders.xmlfile(filename, ignoreDocType=True)
This is weird and unnecessary. Fragment takes a docFactory argument for a reason. So, do this instead:
frag = Fragment(docFactory=loaders.xmlfile(filename, ignoreDocType=True))
Yep, found this shortly after I posted (as usual).
ctx.tag.fillSlots(ctx.tag.attributes.get('slot'), fragClass()) return ctx.tag
This is also pretty weird. I'm not understanding what the extra slot is giving you. If it were me, I would just "return frag" here and dispense with the slot in the template as well as the slot-filling.
Thanks! That made my templates quite a bit cleaner (and dropped a couple lines of Python as well). I had stumbled onto something that worked, so I hadn't bothered looking any further for the "right" solution (smacks self).
<div id="content"> <nevow:invisible nevow:render="include" variable="page" slot="content"> <nevow:slot name="content" />
See comment above, I think this slot is extraneous...
Indeed it was. Thanks a lot. Your advice was right on the money. I'm liking Nevow more by the minute =) Regards, Cliff -- Cliff Wells <clifford.wells@comcast.net>