[Product-Developers] Newbie needs help retrieving data values

JYeko jyeko at kalsec.com
Tue Feb 2 14:43:28 UTC 2010

I am very new to Plone product development so please forgive this simple
question but it is something I cannot figure out.  I have a simple
Archetypes based product.  In one class, I have a field that defines the
type of external database (MySQL, etc.).  Now in a different class
definition, I need to get this database parameter.  The following lines of
code work within a class definition:

        settings = getToolByName(self, 'app_settings').settings
        database = settings.getExternalDatabase()

as the local variable database now contains the stored value for the
external database.  However, here is my problem.  I need to set the
Archetype storage parameter with this value but I cannot use this code to do
this because self is not defined before the class is defined.  The following
does not work.

   settings = getToolByName(self, 'app_settings').settings
   database = settings.getExternalDatabase()


   schema = BaseSchema.copy() + Schema((
               label='Instrument description',
           storage = mystorage,

   class Instrument(BaseContent):

So my question:  How do I get the value stored in the database field in the
settings class so I can use it in the schema definition for another class?

Thank you for you time.
View this message in context: http://n2.nabble.com/Newbie-needs-help-retrieving-data-values-tp4501170p4501170.html
Sent from the Product Developers mailing list archive at Nabble.com.

More information about the Product-Developers mailing list