Changeset 11495


Ignore:
Timestamp:
13 Mar 2014, 15:39:27 (11 years ago)
Author:
uli
Message:

Make sequence length change a view attribute.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/widgets/sequencewidget.py

    r8057 r11495  
    3030from zope.schema.interfaces import IField, IList
    3131
     32
    3233class KofaSequenceWidget(ListSequenceWidget):
    3334    """A sequence widget for lists.
     
    3738    """
    3839    template = ViewPageTemplateFile('sequencewidget.pt')
     40    _kofa_seq_len_changed = False
     41
     42    def _generateSequence(self):
     43        result = super(KofaSequenceWidget, self)._generateSequence()
     44        if ((self.name + '.add' in self.request.form) or
     45            (self.name + '.remove' in self.request.form)):
     46            self._kofa_seq_len_changed = True
     47        return result
     48
    3949
    4050class KofaSequenceDisplayWidget(SequenceDisplayWidget):
     
    8595        return contents
    8696
     97
    8798# Register our sequence widgets as default for lists.
    8899@grok.adapter(IList, IField, IBrowserRequest)
     
    91102    return KofaSequenceWidget(obj, field, req, *args, **kw)
    92103
     104
    93105@grok.adapter(IList, IField, IBrowserRequest)
    94106@grok.implementer(IDisplayWidget)
Note: See TracChangeset for help on using the changeset viewer.