both hostnames and mail addresses should composed by lowercase letters
[plcapi.git] / PLC / Nodes.py
index 679254a..28ff8c1 100644 (file)
@@ -5,6 +5,7 @@
 # Copyright (C) 2006 The Trustees of Princeton University
 #
 # $Id$
+# $URL$
 #
 
 from types import StringTypes
@@ -87,6 +88,7 @@ class Node(Row):
     tags = { }
 
     def validate_hostname(self, hostname):
+        hostname = hostname.lower()
         if not valid_hostname(hostname):
             raise PLCInvalidArgument, "Invalid hostname"
 
@@ -247,11 +249,15 @@ class Node(Row):
         """
 
         assert 'node_id' in self
-       assert 'interface_ids' in self
 
        # we need to clean up InterfaceTags, so handling interfaces as part of join_tables does not work
-       for interface in Interfaces(self.api,self['interface_ids']):
-           interface.delete()
+        # federated nodes don't have interfaces though so for smooth transition from 4.2 to 4.3
+        if 'peer_id' in self and self['peer_id']:
+            pass
+        else:
+            assert 'interface_ids' in self
+            for interface in Interfaces(self.api,self['interface_ids']):
+                interface.delete()
 
         # Clean up miscellaneous join tables
         for table in self.join_tables: