Changeset 13019 for trunk


Ignore:
Timestamp:
05/25/11 16:19:08 (13 years ago)
Author:
sil
Message:
  • Changed unique-constraint of Interface.hwaddress; now unique_together with Interface.network
  • Added exception handling to print obj.unicode() instead of obj.label
Location:
trunk/sara_cmt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sara_cmt/cmt.py

    r12961 r13019  
    188188
    189189    if objects:
    190         logger.info('Found %s entities matching query: %s'
    191             % (len(objects), ', '.join([_object.label for _object in objects])))
     190        # Temporary try-except. See subtrac.sara.nl/osd/interne-services/ticket/164
     191        try:
     192            logger.info('Found %s entities matching query: %s'
     193                % (len(objects), ', '.join([_object.label for _object in objects])))
     194        except AttributeError:
     195            logger.info('Found %s entities matching query: %s'
     196                % (len(objects), ', '.join([_object.__unicode__() for _object in objects])))
    192197        confirmed = not parser.values.INTERACTIVE or \
    193198            raw_input('Are you sure? [Yn] ')
  • trunk/sara_cmt/sara_cmt/cluster/models.py

    r13004 r13019  
    161161                                 help_text="6 Octets, optionally delimited by \
    162162                                 a space ' ', a hyphen '-', or a colon ':'.",
    163                                  unique=True, validators=[hwaddress_validator])
     163                                 validators=[hwaddress_validator])
    164164    ip        = models.IPAddressField(blank=True)
    165165
    166166    class Meta:
    167         unique_together = ('network', 'ip')
     167        unique_together = (('network', 'ip'), ('network', 'hwaddress'))
    168168        ordering = ('host__cluster__name', 'host__rack__label', 'host__first_slot')
    169169
Note: See TracChangeset for help on using the changeset viewer.