I think I can implement this with PEP 252(?) descriptors:
class NiftyDateWidget(LiveElement): docFactory = loader.genshifile('blah.xhtml') # as usual
...
class genshifile(object): def __init__(self, filename): self.filename = filename self._cache = NOCACHE
def __get__(self, instance, cls): if self._cache is NOCACHE: gf = _GenshiFile(filename) gf.object = instance self._cache = gf else: gf = self._cache return gf
Then, the class _GenshiFile is what genshifile used to be; but load is modified to use self.object instead of the context.
I think I can implement this with PEP 252(?) descriptors:
class NiftyDateWidget (LiveElement) : genshifile( 'blah.xhtml' ) # as usual
docFactory = loader.
...
class genshifile(object):
self.filename = filename
def __init__(self, filename):
self._cache = NOCACHE
def __get__(self, instance, cls): filename)
gf. object = instance
self. _cache = gf
if self._cache is NOCACHE:
gf = _GenshiFile(
else:
gf = self._cache
return gf
Then, the class _GenshiFile is what genshifile used to be; but load is modified
to use self.object instead of the context.