Changeset 6471


Ignore:
Timestamp:
Dec 21, 2008, 2:05:22 AM (16 years ago)
Author:
andrea
Message:
  • bugfix in InterfaceForm::clean_ip() :

when dealing with ethernet interfaces (and more in general
with 'not-ap' and 'not-link' ones) an IPCalc object was
returned instead of returning an actual ip address, causing
the underlying model implementation to fail (since it wasn't
a supported datatype to be used in queries).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/exodus/forms.py

    r6469 r6471  
    167167        ap = self.cleaned_data.get('accesspoint')
    168168        edit = bool(self.instance.pk)
     169
     170        if not link_is_wireless(self):
     171            return ip
     172
    169173        # if we have an error, we don't calculate new ip addresses.
    170         import pdb; pdb.set_trace() ;
     174        #import pdb; pdb.set_trace() ;
    171175        if self._errors:
    172176            return ip
     
    187191        #XXX: and not accespoint
    188192        if not link and not ap:
    189             ip = IPCalc(node, 32)
    190193            self.data['netmask'] = 32
    191             return ip
     194            try:
     195                new_ip = IPCalc(node, 32)
     196            except Exception:
     197                return ip   
     198            return new_ip.ips[0]
    192199
    193200        return ip
Note: See TracChangeset for help on using the changeset viewer.