Access to context in processForm

classic Classic list List threaded Threaded
3 messages Options
Jonas Nielsen Jonas Nielsen
Reply | Threaded
Open this post in threaded view
|

Access to context in processForm

I have overwritten processForm to send an email when saving an
Archetype. This works fine.

However now I need some information from the context (i.e. "here")(i.e.
not self).

How do I access the context from a function in a product ? Is the only
way to pass it as a parameter ? If so, what should I overwrite to get
access to context in processForm. The only way it seems to be called is
in registerClasses in ArchetypesTool.py. Should overwrite this method
(it doesn't seem to work)?

Has anyone other ideas how I could call a function from another product
when saving an archetype ?



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Archetypes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/archetypes-users
Reinout van Rees Reinout van Rees
Reply | Threaded
Open this post in threaded view
|

Re: Access to context in processForm

On Wed, 19 Oct 2005, Jonas Nielsen wrote:

> How do I access the context from a function in a product ? Is the
> only way to pass it as a parameter ? If so, what should I overwrite
> to get access to context in processForm.

Think of it the other way around. How can the context access the
function: normally you'd call context.yourFunction(). Then
yourFunction() is passed 'context' as the value of 'self'.

I hope that this is what you mean ;-)

Reinout

--
Reinout van Rees                         [hidden email]
http://vanrees.org/weblog/                  http://zestsoftware.nl/
"Military engineers build missiles. Civil engineers build targets."


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Archetypes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/archetypes-users
Jens W. klein Jens W. klein
Reply | Threaded
Open this post in threaded view
|

Re: Access to context in processForm

In reply to this post by Jonas Nielsen
Am Mittwoch, den 19.10.2005, 13:49 +0200 schrieb Jonas Nielsen:

> I have overwritten processForm to send an email when saving an
> Archetype. This works fine.
>
> However now I need some information from the context (i.e. "here")(i.e.
> not self).
>
> How do I access the context from a function in a product ? Is the only
> way to pass it as a parameter ? If so, what should I overwrite to get
> access to context in processForm. The only way it seems to be called is
> in registerClasses in ArchetypesTool.py. Should overwrite this method
> (it doesn't seem to work)?
>
> Has anyone other ideas how I could call a function from another product
> when saving an archetype ?

The TypesWidget's (and almost every widget is derived from it)
process_form has the follwoing signature:

    def process_form(self, instance, field, form, empty_marker=None,
                     emptyReturnsMarker=False):

'instance' is what you would call 'here' - its the instance of the
object, the content, it works on.

hth Jensens

--
Jens Klein
Managing Director - Software Architect

BlueDynamics Tyrol           WEB APPLICATIONS: ZOPE, PLONE - MDA, SOA
Klein & Partner KEG          production: concept, development, design
http://www.bluedynamics.com  consulting: analysis, coaching, training
+43 512 890077               management: projects, process, community




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Archetypes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/archetypes-users