Re: @form.action(attribut) überschreiben

Vladislav Vorobiev <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[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?

Gruß
Vladislav

-- 
Best Regards
Vlad Vorobiev


_______________________________________________
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.