Mark,

One way to accomplish this is to use a 'monkey patch'. This is a bit wonky, but commonly used to simply override methods or variables in Products without changing the live code. A monkey patch is basically a runtime override of another product.

The simplest way to do this is to create a new product (just a new folder in the Products folder, like MyATVocabularyManager), and add an __init__.py file to it. In the __init__.py file, define your new schema, then at the end of the file, set ATVocabularyManager's schema to yours, something like:

    from Products.ATVocabularyManager as ATVocabularyManager
    ATVocabularyManager.simple.schema = schema

Then start up your Zope, and hopefully you get your new schema. ;)

To see some samples of this, do: grep -ir monkey Products/*
Also, you could probably import the original schema, then only change the pieces you want to change, then use that new schema.

Chris

On 5/11/10 4:31 PM, Mark Phillips wrote:
I need to make a small change to ATVocabularyManager. Specifically, I need a simple vocabulary value to be longer than 32 characters; ie a TextField and not a StringField for the value of the key-value pair. What is the "right" way to make this change - copy ATVocabularyManger to MyATVocabularyManger, make the change to simple.py and install MyAtVocabularyManger? Or is there a way to "extend" the product as I can extend a class and just change the schema for simple.py? Not sure how I would do the second option.

Thanks!

Mark

P.S. I am referring to Plone 2.5.5


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

--
Chris Crownhart
Core Software Group
http://www.coresoftwaregroup.com
303/809-1001

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to