Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UNHANDLED EXCEPTION (2014-09-19 22:52:48.739742)
- Working directory: /opt/noc
- <type 'exceptions.AttributeError'>
- 'StringParameter' object has no attribute '_clean'
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: /opt/noc/inv/models/modelinterface.py (Line: 146)
- Function: clean_data
- 139 for i_name in d:
- 140 mi = ModelInterface.objects.filter(name=i_name).first()
- 141 if not mi:
- 142 raise ModelDataError("Unknown interface '%s'" % i_name)
- 143 v = d[i_name]
- 144 for a in mi.attrs:
- 145 if a.name in v:
- 146 ==> v[a.name] = T_MAP[a.type]._clean(v[a.name])
- 147 return d
- Variables:
- a = <ModelInterfaceAttr: part_no0>
- d = {'asset': {'part_no0': 'SFP-10G-LR'}}
- i_name = 'asset'
- mi = <ModelInterface: asset>
- v = {'part_no0': 'SFP-10G-LR'}
- data = {'asset': {'part_no0': 'SFP-10G-LR'}}
- cls = <class 'noc.inv.models.modelinterface.ModelInterface'>
- ------------------------------------------------------------------------
- File: /opt/noc/inv/apps/objectmodel/views.py (Line: 31)
- Function: clean
- 24 model = ObjectModel
- 25 parent_model = DocCategory
- 26 parent_field = "parent"
- 27 query_fields = ["name__icontains", "description__icontains"]
- 28
- 29 def clean(self, data):
- 30 if "data" in data:
- 31 ==> data["data"] = ModelInterface.clean_data(data["data"])
- 32 if "plugins" in data and data["plugins"]:
- 33 data["plugins"] = [x.strip() for x in data["plugins"].split(",") if x.strip()]
- 34 else:
- 35 data["plugins"] = None
- 36 return super(ObjectModelApplication, self).clean(data)
- 37
- Variables:
- self =
- <noc.inv.apps.objectmodel.views.ObjectModelApplication object at 0x8107cb450>
- data =
- {'connection_rule': '',
- 'connections': [{'cross': None,
- 'description': 'XFP Connector',
- 'direction': 'o',
- 'gender': 'm',
- 'group': None,
- 'internal_name': None,
- 'name': 'in',
- 'protocols': ['TransEth10G'],
- 'type': '541302c6f3b6823b142ce596'},
- {'cross': None,
- 'description': 'RX Port',
- 'direction': 's',
- 'gender': 'f',
- 'group': None,
- 'internal_name': None,
- 'name': 'rx',
- 'protocols': ['>10GBASELR-1310'],
- 'type': '541302c6f3b6823b142ce5be'},
- {'cross': None,
- 'description': 'TX Port',
- 'direction': 's',
- 'gender': 'f',
- 'group': None,
- 'internal_name': None,
- 'name': 'tx',
- 'protocols': ['<10GBASELR-1310'],
- 'type': '541302c6f3b6823b142ce5be'}],
- 'cr_context': 'XCVR',
- 'data': {'asset': {'part_no0': 'SFP-10G-LR'}},
- 'description': 'Cisco SFP+ 10G LR transceiver',
- 'id': 'NOC.inv.objectmodel.Model-sm-3',
- 'name': 'Cisco | Transceiver | 10G | SFP-10G-LR',
- 'plugins': '',
- 'vendor': '541302c5f3b6823b142ce4ec'}
- ------------------------------------------------------------------------
- File: /opt/noc/lib/app/extdocapplication.py (Line: 254)
- Function: api_create
- 247 "success": True,
- 248 "data": data
- 249 }
- 250
- 251 @view(method=["POST"], url="^$", access="create", api=True)
- 252 def api_create(self, request):
- 253 try:
- 254 ==> attrs = self.clean(self.deserialize(request.raw_post_data))
- 255 except ValueError, why:
- 256 return self.response(str(why), status=self.BAD_REQUEST)
- 257 if self.pk in attrs:
- 258 del attrs[self.pk]
- 259 if self.has_uuid and not attrs.get("uuid"):
- 260 attrs["uuid"] = uuid.uuid4()
- Variables:
- self =
- <noc.inv.apps.objectmodel.views.ObjectModelApplication object at 0x8107cb450>
- request =
- <WSGIRequest
- path:/inv/objectmodel/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {u'{"name":"Cisco | Transceiver | 10G | SFP-10G-LR","description":"Cisco SFP 10G LR transceiver","vendor":"541302c5f3b6823b142ce4ec","connection_rule":"","cr_context":"XCVR","plugins":"","data":{"asset":{"part_no0":"SFP-10G-LR"}},"connections":[{"name":"in","type":"541302c6f3b6823b142ce596","group":null,"direction":"o","gender":"m","cross":null,"protocols":["TransEth10G"],"internal_name":null,"description":"XFP Connector"},{"name":"rx","type":"541302c6f3b6823b142ce5be","group":null,"direction":"s","gender":"f","cross":null,"protocols":[">10GBASELR-1310"],"internal_name":null,"description":"RX Port"},{"name":"tx","type":"541302c6f3b6823b142ce5be","group":null,"direction":"s","gender":"f","cross":null,"protocols":["<10GBASELR-1310"],"internal_name":null,"description":"TX Port"}],"id":"NOC.inv.objectmodel.Model-sm-3"}': [u'']}>,
- COOKIES:{'csrftoken': '102bc6e214b4272a803d0c0a1dd106aa',
- 'sessionid': '90d47410a23e91785ef6af075735626c'},
- META:{'CONTENT_LENGTH': '824',
- 'CONTENT_TYPE': 'application/json; charset=UTF-8',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'ru,en-us;q=0.7,en;q=0.3',
- 'HTTP_CACHE_CONTROL': 'no-cache',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=102bc6e214b4272a803d0c0a1dd106aa; sessionid=90d47410a23e91785ef6af075735626c',
- 'HTTP_DNT': '1',
- 'HTTP_HOST': '127.0.0.1:8000',
- 'HTTP_PRAGMA': 'no-cache',
- 'HTTP_REFERER': 'http://noc/main/desktop/',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0',
- 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
- 'PATH_INFO': u'/inv/objectmodel/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'POST',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': '127.0.0.1',
- 'SERVER_PORT': '8000',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x8079484b0>,
- 'wsgi.input': <_io.BytesIO object at 0x8132f0110>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- ------------------------------------------------------------------------
- File: /opt/noc/lib/app/site.py (Line: 246)
- Function: inner
- 239 for k, v in request.POST.lists())
- 240 elif request.method == "GET":
- 241 a = dict((k, v[0] if len(v) == 1 else v)
- 242 for k, v in request.GET.lists())
- 243 app_logger.debug("API %s %s %s",
- 244 request.method, request.path, a)
- 245 # Call handler
- 246 ==> r = v(request, *args, **kwargs)
- 247 # Dump SQL statements
- 248 if self.log_sql_statements:
- 249 from django.db import connections
- 250 tsc = 0
- 251 sc = defaultdict(int)
- 252 for conn in connections.all():
- Variables:
- args = ()
- view_map =
- {'GET': <bound method ObjectModelApplication.api_list of <noc.inv.apps.objectmodel.views.ObjectModelApplication object at 0x8107cb450>>,
- 'POST': <bound method ObjectModelApplication.api_create of <noc.inv.apps.objectmodel.views.ObjectModelApplication object at 0x8107cb450>>}
- Form = <class 'django.forms.forms.Form'>
- PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
- DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
- self = <noc.lib.app.site.Site object at 0x80d44b150>
- v =
- <bound method ObjectModelApplication.api_create of <noc.inv.apps.objectmodel.views.ObjectModelApplication object at 0x8107cb450>>
- request =
- <WSGIRequest
- path:/inv/objectmodel/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {u'{"name":"Cisco | Transceiver | 10G | SFP-10G-LR","description":"Cisco SFP 10G LR transceiver","vendor":"541302c5f3b6823b142ce4ec","connection_rule":"","cr_context":"XCVR","plugins":"","data":{"asset":{"part_no0":"SFP-10G-LR"}},"connections":[{"name":"in","type":"541302c6f3b6823b142ce596","group":null,"direction":"o","gender":"m","cross":null,"protocols":["TransEth10G"],"internal_name":null,"description":"XFP Connector"},{"name":"rx","type":"541302c6f3b6823b142ce5be","group":null,"direction":"s","gender":"f","cross":null,"protocols":[">10GBASELR-1310"],"internal_name":null,"description":"RX Port"},{"name":"tx","type":"541302c6f3b6823b142ce5be","group":null,"direction":"s","gender":"f","cross":null,"protocols":["<10GBASELR-1310"],"internal_name":null,"description":"TX Port"}],"id":"NOC.inv.objectmodel.Model-sm-3"}': [u'']}>,
- COOKIES:{'csrftoken': '102bc6e214b4272a803d0c0a1dd106aa',
- 'sessionid': '90d47410a23e91785ef6af075735626c'},
- META:{'CONTENT_LENGTH': '824',
- 'CONTENT_TYPE': 'application/json; charset=UTF-8',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'ru,en-us;q=0.7,en;q=0.3',
- 'HTTP_CACHE_CONTROL': 'no-cache',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=102bc6e214b4272a803d0c0a1dd106aa; sessionid=90d47410a23e91785ef6af075735626c',
- 'HTTP_DNT': '1',
- 'HTTP_HOST': '127.0.0.1:8000',
- 'HTTP_PRAGMA': 'no-cache',
- 'HTTP_REFERER': 'http://noc/main/desktop/',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0',
- 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
- 'PATH_INFO': u'/inv/objectmodel/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'POST',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': '127.0.0.1',
- 'SERVER_PORT': '8000',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x8079484b0>,
- 'wsgi.input': <_io.BytesIO object at 0x8132f0110>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- app_logger = <logging.Logger object at 0x8107cb890>
- InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
- to_log_api_call = False
- kwargs = {}
- nq = <function nq at 0x8134e05f0>
- app =
- <noc.inv.apps.objectmodel.views.ObjectModelApplication object at 0x8107cb450>
- ------------------------------------------------------------------------
- END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment