On Sat, Aug 27, 2011 at 4:38 PM, David Glick <[email protected]> wrote: > It sounds like we need to add support for a flag in jsregistry.xml to > indicate that a resource should be added in a disabled state if it's not > present, but remain enabled if it is already present and enabled. This could > then be used for these optional scripts bundled with p.a.jquerytools.
Perhaps, instead of an additional flag/attribute, it makes sense to allow a value of "None" as a valid choice -- conveying ambivalence and deference to previously existing values. (True|False|None) would all be legal enabled attribute values in jsregistry.xml, each with distinct meaning. Products.ResourceRegistries.tools.JSRegistry.updateScript() conveniently skips modification on a keyword argument of enabled=None -- useful, but insufficient. I want to update the handler to treat the enabled="None" (or "none") as: (a) enabled=False [1] on initial import attempt, and (b) as enabled=None for JSRegistryTool.updateScript() [2]. Soon, I may try to implement this on respective Products.ResourceRegistries and plone.app.jquerytools branches. I will ping plone-developers for review once I do. Sean Notes: [1] AFAICT, one could safely store enabled=None on a Resource object (as the getEnabled() accessor casts to a bool), but this is likely an untested road to hell. I do not want to store "None" -- just use that word as a semantically distinct way to specify intent in jsregistry.xml in products like plone.app.jquerytools. [2] updateScript() method called from an except block when install fails (dupe/existing record): http://dev.plone.org/plone/browser/ResourceRegistries/trunk/Products/ResourceRegistries/exportimport/resourceregistry.py#L150 (alecm's comment for this block r10486: "this feels dirty too" -- yep). _______________________________________________ Product-Developers mailing list [email protected] https://lists.plone.org/mailman/listinfo/plone-product-developers
