Hello, > class BaseSchema(colander.Schema): > some field = <etc...> > > Another package is a plugin, and would like to add a field to that schema. > > At least in my head, this would be quite simple with a zope object event, > something like SchemaCreated that would fire every time a schema was > instantiated. This would work with Pyramids subscribers. > (Pretty much like repoze.folder does when something is added) > > This won't work AFAIK, since the schema will be of the SchemaNode class > once instantiated. Any relation to the initial class is gone for this > object.
I'm afraid I don't follow. Either you need to change the BaseSchema class, or you need to change the instances created from it. If you want to change the class, formalising this with an event instead of monkey-patching the new fields onto it is going to be a little tricky (at which time should the event be sent?), but I think you easily could have BaseSchema (or rather, a suitable base class) send a SchemaCreated event in its __init__, and then your plugin could modify each newly created instance. This doesn't strike me as very elegant, though, to be honest... but I don't have a ready idea what this kind of extension mechanism could look like. Wolfgang -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-devel+unsubscr...@googlegroups.com. To post to this group, send email to pylons-devel@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-devel. For more options, visit https://groups.google.com/groups/opt_out.