I'm keen to find and use something which will allow me to validate and convert
an arbitrary-depth dictionary outside the forms realm, eg.
class GlobalObject(schemaish.attr.LeafAttribute):
# some code here that i don't have yet
class Directive(schemaish.Structure):
# some code here that i dont have yet
class Subscriber(Directive):
event_type = GlobalObject()
subscriber = GlobalObject()
structure = {'event_type':'mypackage.MyClass',
'subscriber':'mypackage.myfunction'}
directive = Subscriber()
converted = directive.convert(structure)
print converted
{'event_type':<class MyClass>, 'subscriber':<function myfunction>}
E.g. the above converts a string to a global Python object via __import__.
I realize this is a small matter of coding and so forth. Has anyone started
down such a path already?
--
Chris McDonough
Agendaless Consulting, Fredericksburg VA
The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book
Hi all,
I'm keen to find and use something which will allow me to validate and convert an arbitrary-depth dictionary outside the forms realm, eg.
class GlobalObject(schemaish.attr.LeafAttribute):
# some code here that i don't have yet
class Directive(schemaish.Structure):
# some code here that i dont have yet
class Subscriber(Directive):
event_type = GlobalObject()
subscriber = GlobalObject()
structure = {'event_type':'mypackage.MyClass',
'subscriber':'mypackage.myfunction'}
directive = Subscriber()
converted = directive.convert(structure)
print converted
{'event_type':<class MyClass>, 'subscriber':<function myfunction>}
E.g. the above converts a string to a global Python object via __import__.
I realize this is a small matter of coding and so forth. Has anyone started down such a path already?