Ignore:
Timestamp:
8 Jan 2015, 10:33:18 (10 years ago)
Author:
Henrik Bettermann
Message:

Do not compare ResultEntry? objects but their attributes. Then we do not need to remove unchanged product options from data.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/interfaces.py

    r12378 r12419  
    120120    return True
    121121
    122 # Define a validation method for email addresses
     122# Define a validation method for ids
    123123class NotIdValue(schema.ValidationError):
    124124    __doc__ = u"Invalid id"
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/browser.py

    r12413 r12419  
    197197    @action(_('Save'), style='primary')
    198198    def save(self, **data):
    199         # Remove unchanged product options from data
    200         new_options = data.get('options')
    201         if new_options and (len(new_options) == len (self.context.options)):
    202             new = False
    203             for i in range(len(new_options)):
    204                 new_option_str = new_options[i].to_string()
    205                 stored_options_str = self.context.options[i].to_string()
    206                 if new_option_str != stored_options_str:
    207                     new = True
    208                     break
    209             if not new:
    210                del data['options']
    211199        msave(self, **data)
    212200        # Save multilingual dict
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/productoptions.py

    r12378 r12419  
    7777        return
    7878
     79    def __eq__(self, obj):
     80        default = object()
     81        result = []
     82        for name in ('title', 'fee', 'currency',):
     83            result.append(
     84                getattr(self, name) == getattr(obj, name, default))
     85        return False not in result
     86
    7987    def to_string(self):
    8088        """A string representation that can be used in exports.
Note: See TracChangeset for help on using the changeset viewer.