On Wed, Nov 08, 2006 at 03:33:50AM -0800, datenimperator wrote:
>
> Hi,
>
> my component consists of two classes, one of them being an admin screen
> to set some options, that are defined and used in the other class.
> Since components are singletons, how do I access the class members
> properly?
>
> class SomePlugin(Component)
> myvalue = BoolOption(...)
>
> class PluginAdminPage(Component)
> def process_admin_request(...)
> req.hdf['myvalue'] = <how_can_I_access_my_value?>
>
> Can anybody help, please? Regards,
class PluginAdminPage(Component)
def process_admin_request(...)
req.hdf['myvalue'] = SomePlugin(self.env).myvalue
As you have noticed, Trac components are singleton objects, so
instantiating a new component won't actually create a new instance, it
will return the singleton.
--
Evolution: Taking care of those too stupid to take care of themselves.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Trac Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---