In the Presentation Tier docs, we see a number of examples of using xhmlt.Renderer() without any component. Motivated by this,
I am attempting to create a renderer for my mixin. That is to say, I
mixin a number of classes into a class and then when I render the
class, I want to render its mixins using each mixins rendeing method.
Here is the code for one such mixin:
class ValueTyped(object):
def __init__(self):
super(ValueTyped, self).__init__()
self.value_type = ''
def valuetyped_render(self, editor):
id_type = {
'25': 'Timestamp with Jiffies',
'26': 'Timestamp',
'32': 'Date'
}
h = xhtml.Renderer()
tp("H..: {0}".format(h))
tp("H.S: {0}".format(h.select))
hsr = h.select.renderer
tp("HSR: {0}".format(hsr))
hsrc = h.select.renderer.component()
tp("HSRC {0}".format(hsrc))
tp("E..: {0}".format(editor))
tp("EVT: {0}".format(editor.value_type))
with h.select.action(editor.value_type):
with h.optgroup(label='xxx'):
for id,type in id_type.iteritems():
h << h.option(type, value=type)
tp("Returning H_ROOT: {0}".format(h.root))
return h.root
Now, the problem is that the code breaks on the source line:
with h.select.action(editor.value_type):
because nagare.namespaces.action() has this line:
action = security.wrapper(action, permissions, subject or self.renderer.component())
And the part of that line that fails is `self.renderer.component())`
So my question is:
1. is it wrong for one to create a renderer and not bind a component
to it?
2. If a renderer needs a component, how will it get one? I attempted
to pass in the component that called this method and that was not
acceptable to lxml because a node realized that it's child was itself.