Re: @form.action(attribut) überschreiben

Vladislav Vorobiev <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[email protected]>
Am 23. Oktober 2010 16:56 schrieb Vladislav Vorobiev <[email protected]>:
>>> Hallo Zusammen!
>>>
>>> Ich habe folgende zwei Klassen:
>>>
>>> class GenericFormularEdit(EditForm):
>>>    description = _(u"Please fill out all fields to get more information")
>>>    form_fields = form.Fields(eval ('IEinEi')
>>>    addbutton   = u'APPLY'
>>>
>>>    @form.action(_(addbutton))
>>>    def action(self, actions, data)
>>>        pass
>>>
>>>
>>> class UserEdit(GenericFormularEdit):
>>>    form_fields = form.Fields(IUser)
>>>    description = _(u"Add Information")
>>>    addbutton   = u'APPLY MIT MEINEM TEXT'
>>>
>>>    def __call__(self):
>>>        return super(UserEdit, self).__call__()
>>>
>>> Wie kann erreichen, dass beim Aufruf der Klasse UserEdit ins
>>> @form.action(_(addbutton)) das 'addbutton'  attribute von der Kind
>>> Klasse also UserEdit eingesetzt wird?
>>> Beim Aufruf wird das Attribut der Vaterklasse eingesetzt also 'APPLY'
>>> soll aber 'APPLY MIT MEINEM TEXT'.
>>> Geht es Irgend wie? Ich möchte nicht die action() Methode neu definieren.
>>
>> du kannst UserEdit.updateActions() benutzen, um die Actions zu verändern.
>> Du must aber vorher eine Kopie von GeneriFormularEdit.actions erstellen,
>> damit du nicht die Actions der Elternklasse änderst. Das kann seltsame
>> Effekte produzieren.
>> <http://zope3.mpg.de/cgi-bin/twiki/view/Zope/FormLib> dokumentiert das gut.
>>
>> Da _(addform) beim der definition des decorators aufgerufen wirst Du mit
>> dem decorator nicht weiterkommen.
>>
>> ..Carsten
>
>
> Hallo Carsten,
>
> vielen Dank für den Ansatz.
> Ich kann dort ergend wie nichts ändern durch zuweisen der Attribute Es
> wird nicht übernomen.
>
> Ich bin im pdb und z.B.
>
> (Pdb) self.actions.byname['form.actions.apply'].label
> (u'Apply'
> (Pdb) self.actions.byname['form.actions.apply'].label="test"
> (Pdb) self.actions.byname['form.actions.apply'].label
> u'Apply'
>
> Hast du eine Idee woran das liegen könnte?

Etwas Irritierend ist auch dass laut
http://zope3.mpg.de/cgi-bin/twiki/view/Zope/FormLib

es eine Methode addClass gibt. Dir listet die aber nicht auf.

dir(self.actions.byname['form.actions.apply'])
['__ac_permissions__', '__class__', '__delattr__', '__dict__',
'__doc__', '__format__', '__get__', '__get____roles__',
'__getattribute__', '__hash__', '__implemented__', '__init__',
'__module__', '__name__', '__name____roles__', '__new__',
'__providedBy__', '__provides__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', '__weakref__', '_identifier', 'available',
'available__roles__', 'bindMethods', 'condition',
'condition__roles__', 'data', 'data__roles__', 'failure',
'failure__roles__', 'failure_handler', 'form', 'label',
'label__roles__', 'name', 'name__roles__', 'prefix',
'prefix__roles__', 'render', 'render__roles__', 'setName',
'setPrefix', 'setPrefix__roles__', 'submitted', 'submitted__roles__',
'success', 'success__roles__', 'success_handler', 'update',
'update__roles__', 'validate', 'validate__roles__', 'validator',
'validator__roles__']


_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
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.