CORD-1172: Brought Metronet service over to xproto
Change-Id: I4e9d14b0b5cd7a2fe9ce8efdde432566fc5d7f9d
diff --git a/xos/attic/networkedgeport_model.py b/xos/attic/networkedgeport_model.py
new file mode 100644
index 0000000..52f17fe
--- /dev/null
+++ b/xos/attic/networkedgeport_model.py
@@ -0,0 +1,22 @@
+def __unicode__(self):
+ return u'%s' % (self.pid)
+
+def save(self, *args, **kwargs):
+
+ if self.latlng:
+ try:
+ latlng_value = getattr(self, 'latlng').strip()
+ if (latlng_value.startswith('[') and latlng_value.endswith(']') and latlng_value.index(',') > 0):
+ lat = latlng_value[1: latlng_value.index(',')].strip()
+ lng = latlng_value[latlng_value.index(',') + 1: len(latlng_value) - 1].strip()
+
+ #If lat and lng are not floats, the code below should result in an error.
+ lat_validation = float(lat)
+ lng_validation = float(lng)
+ else:
+ raise ValueError("The lat/lng value is not formatted correctly.")
+ except:
+ raise ValueError("The lat/lng value is not formatted correctly.")
+
+ super(NetworkEdgePort, self).save(*args, **kwargs)
+