Re: a simple trigger (gnue-forms)

Jason Cater <[email protected]>
Newsgroups gmane.comp.gnu.enterprise.general
Message-ID <[email protected]>
> Yet, i'd like to understand better how does gnue-forms work.
> I thought that the objects that are available inside the triggers
> are instances of the GFBlock, GFField, etc classes.
> In my case this would mean that blkProd.fldVal are blkProd.fldPu are
> instances of the GFField class.
> However: looking at this class, i don't see the set() and get() methods.
> Where should I look when i want to know what methods does a
> particular object (like blkProd,  fldVal, etc)  have ?

Adrian, 

The GFField, GFBlock, etc, objects are not directly accessible from triggers. 
We felt this best for security and code cleanliness reasons. 

In your trigger namespaces, we actually put a wrapper object, which exposes 
pre-defined functions of the underlying main object (i.e. GFField, etc.)

We are trying to document all available functions in the Form Developer's 
Guide, Appendix C. However, if you are looking at the Python source code, 
each GF* object will define a dictionary: 

    self._triggerFunctions={'allowedValues':{'function':self.allowedValues,},
            'autofillBySequence': 
                       {'function':self.triggerAutofillBySequence},
            'isEmpty':{'function':self.isEmpty},
            'resetForeignKey':{'function':self.resetForeignKey},
            'set':{'function':self.triggerSetValue},
            'get':{'function':self.getValue},
            'clear': {'function': self.resetToDefault}
     }

This contains a mapping of exposed triggers functions and which python method 
they actually call. 

Given the above snippet from GFField.py, if you call 
field.autofillBySequence() in a trigger, then 
GFField.triggerAutofillBySequence() is actually run. 

-- Jason
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.