Advertisement
Izya12

CSV Export/Import

Mar 15th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.53 KB | None | 0 0
  1. UNHANDLED EXCEPTION (2018-03-15 10:00:26.301329)
  2. PROCESS: ./services/web/service.py
  3. VERSION: 15.05.1+microservices.9141.4c85fb66
  4. BRANCH: microservices CHANGESET: 4c85fb66
  5. ERROR FINGERPRINT: 6743fbae-042a-59d2-b1f6-fe3c995ef940
  6. WORKING DIRECTORY: /opt/noc
  7. EXCEPTION: <class 'django.core.urlresolvers.NoReverseMatch'> Reverse for 'import' with arguments '(u'sa.ManagedObject',)' and keyword arguments '{}' not found.
  8. START OF TRACEBACK
  9. ------------------------------------------------------------------------
  10. File: local/lib/python2.7/site-packages/django/core/urlresolvers.py (Line: 422)
  11. Function: _reverse_with_prefix
  12. 415 m = getattr(lookup_view, '__module__', None)
  13. 416 n = getattr(lookup_view, '__name__', None)
  14. 417 if m is not None and n is not None:
  15. 418 lookup_view_s = "%s.%s" % (m, n)
  16. 419 else:
  17. 420 lookup_view_s = lookup_view
  18. 421 raise NoReverseMatch("Reverse for '%s' with arguments '%s' and keyword "
  19. 422 ==> "arguments '%s' not found." % (lookup_view_s, args, kwargs))
  20. 423
  21. 424 class LocaleRegexURLResolver(RegexURLResolver):
  22. 425 """
  23. 426 A URL resolver that always matches the active language code as URL prefix.
  24. 427
  25. 428 Rather than taking a regex argument, we just override the ``regex``
  26. Variables:
  27. candidate = u'/main/csv/import/sa.ManagedObject/'
  28. val = u'sa.ManagedObject'
  29. _prefix = u'/'
  30. pattern = 'main/csv/import/(?P<model>[a-z1-9]+\\.[a-z1-9]+)/$'
  31. self =
  32. <RegexURLResolver [<RegexURLResolver [<RegexURLPattern None ^launch_info/$>, <RegexURLPattern import ^import/(?P<model>[a-z1-9]+\.[a-z1-9]+)/$>, <RegexURLPattern index ^$>] (None:None) main/csv/>] (None:None) ^/>
  33. args = (u'sa.ManagedObject',)
  34. m = None
  35. lookup_view_s = 'import'
  36. possibility = [(u'main/csv/import/%(model)s/', ['model'])]
  37. unicode_args = [u'sa.ManagedObject']
  38. possibilities =
  39. [([(u'main/csv/import/%(model)s/', ['model'])],
  40. 'main/csv/import/(?P<model>[a-z1-9]+\\.[a-z1-9]+)/$',
  41. {})]
  42. lookup_view = 'import'
  43. prefix_norm = u'/'
  44. prefix_args = []
  45. params = ['model']
  46. result = u'main/csv/import/%(model)s/'
  47. defaults = {}
  48. kwargs = {}
  49. n = None
  50. ------------------------------------------------------------------------
  51. File: local/lib/python2.7/site-packages/django/core/urlresolvers.py (Line: 502)
  52. Function: reverse
  53. 495 (key, ':'.join(resolved_path)))
  54. 496 else:
  55. 497 raise NoReverseMatch("%s is not a registered namespace" %
  56. 498 key)
  57. 499 if ns_pattern:
  58. 500 resolver = get_ns_resolver(ns_pattern, resolver)
  59. 501
  60. 502 ==> return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  61. 503
  62. 504 reverse_lazy = lazy(reverse, str)
  63. 505
  64. 506 def clear_url_caches():
  65. 507 global _resolver_cache
  66. 508 global _ns_resolver_cache
  67. Variables:
  68. ns_pattern = 'main/csv/'
  69. args = (u'sa.ManagedObject',)
  70. viewname = 'main:csv:import'
  71. extra = 'csv/'
  72. view = 'import'
  73. current_app = None
  74. prefix = u'/'
  75. parts = ['import', 'csv', 'main']
  76. resolver =
  77. <RegexURLResolver [<RegexURLResolver [<RegexURLPattern None ^launch_info/$>, <RegexURLPattern import ^import/(?P<model>[a-z1-9]+\.[a-z1-9]+)/$>, <RegexURLPattern index ^$>] (None:None) main/csv/>] (None:None) ^/>
  78. kwargs = {}
  79. path = []
  80. ns = 'csv'
  81. urlconf = 'noc.urls'
  82. resolved_path = ['main', 'csv']
  83. ------------------------------------------------------------------------
  84. File: lib/app/site.py (Line: 479)
  85. Function: reverse
  86. 472 """
  87. 473 if self.rx_namespace.match(url):
  88. 474 kw = kwargs.copy()
  89. 475 query = ""
  90. 476 if "QUERY" in kw:
  91. 477 query = "?" + urllib.urlencode(kw["QUERY"])
  92. 478 del kw["QUERY"]
  93. 479 ==> return reverse(url, args=args, kwargs=kw) + query
  94. 480 else:
  95. 481 return url
  96. 482
  97. 483 def sort_menu(self):
  98. 484 """
  99. 485 Sort application menu
  100. Variables:
  101. url = 'main:csv:import'
  102. self = <noc.lib.app.site.Site object at 0x7f3a494d91d0>
  103. args = (u'sa.ManagedObject',)
  104. kw = {}
  105. kwargs = {}
  106. query = ''
  107. ------------------------------------------------------------------------
  108. File: lib/app/application.py (Line: 223)
  109. Function: reverse
  110. 216 """
  111. 217 return "/%s/%s/" % (self.module, self.app)
  112. 218
  113. 219 def reverse(self, url, *args, **kwargs):
  114. 220 """
  115. 221 Reverse URL name to URL
  116. 222 """
  117. 223 ==> return self.site.reverse(url, *args, **kwargs)
  118. 224
  119. 225 def message_user(self, request, message):
  120. 226 """
  121. 227 Send a message to user
  122. 228 """
  123. 229 if "noc_user" in request.COOKIES:
  124. Variables:
  125. url = 'main:csv:import'
  126. self =
  127. <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>
  128. args = (u'sa.ManagedObject',)
  129. kwargs = {}
  130. ------------------------------------------------------------------------
  131. File: lib/app/application.py (Line: 341)
  132. Function: response_redirect
  133. 334 return serve_static(request, path, document_root=document_root)
  134. 335
  135. 336 def response_redirect(self, url, *args, **kwargs):
  136. 337 """
  137. 338 Redirect to URL
  138. 339 """
  139. 340 if ":" in url:
  140. 341 ==> url = self.reverse(url, *args, **kwargs)
  141. 342 return HttpResponseRedirect(url)
  142. 343
  143. 344 def response_redirect_to_referrer(self, request, back_url=None):
  144. 345 """
  145. 346 Redirect to referrer page
  146. 347 """
  147. Variables:
  148. url = 'main:csv:import'
  149. self =
  150. <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>
  151. args = (u'sa.ManagedObject',)
  152. kwargs = {}
  153. ------------------------------------------------------------------------
  154. File: services/web/apps/main/csv/views.py (Line: 54)
  155. Function: view_index
  156. 47 return self.render_plain_text(
  157. 48 csv_export(model),
  158. 49 mimetype="text/csv; encoding=utf-8"
  159. 50 )
  160. 51 else:
  161. 52 return self.response_redirect(
  162. 53 "main:csv:import",
  163. 54 ==> form.cleaned_data["model"]
  164. 55 )
  165. 56 else:
  166. 57 form = ModelForm()
  167. 58 return self.render(request, "index.html", form=form)
  168. 59
  169. 60 class ImportForm(forms.Form):
  170. Variables:
  171. request =
  172. <WSGIRequest
  173. path:/main/csv/,
  174. GET:<QueryDict: {}>,
  175. POST:<QueryDict: {u'action': [u'', u'Import'], u'model': [u'sa.ManagedObject']}>,
  176. COOKIES:{'noc_user': '2|1:0|10:1520917023|8:noc_user|8:YWRtaW4=|ac985a8d416a0f029afe096904571733e0fd0adc4d03abbd326ae0889a993982'},
  177. META:{'CONTENT_LENGTH': '44',
  178. 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
  179. 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
  180. 'HTTP_ACCEPT_ENCODING': 'gzip, br',
  181. 'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
  182. 'HTTP_CACHE_CONTROL': 'max-age=0',
  183. 'HTTP_CONNECTION': 'close',
  184. 'HTTP_COOKIE': 'noc_user="2|1:0|10:1520917023|8:noc_user|8:YWRtaW4=|ac985a8d416a0f029afe096904571733e0fd0adc4d03abbd326ae0889a993982"',
  185. 'HTTP_HOST': '10.220.21.122',
  186. 'HTTP_ORIGIN': 'https://10.220.21.122',
  187. 'HTTP_REFERER': 'https://10.220.21.122/main/csv/',
  188. 'HTTP_REMOTE_USER': 'admin',
  189. 'HTTP_UPGRADE_INSECURE_REQUESTS': '1',
  190. 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',
  191. 'HTTP_X_FORWARDED_FOR': '10.20.13.40',
  192. 'HTTP_X_FORWARDED_PROTO': 'https',
  193. 'HTTP_X_IMFORWARDS': '20',
  194. 'HTTP_X_REAL_IP': '10.20.13.40',
  195. 'HTTP_X_SCHEME': 'https',
  196. 'PATH_INFO': u'/main/csv/',
  197. 'QUERY_STRING': '',
  198. 'REMOTE_ADDR': '10.20.13.40',
  199. 'REQUEST_METHOD': 'POST',
  200. 'SCRIPT_NAME': u'',
  201. 'SERVER_NAME': '10.220.21.122',
  202. 'SERVER_PORT': '443',
  203. 'SERVER_PROTOCOL': 'HTTP/1.0',
  204. 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f3a599f51e0>,
  205. 'wsgi.input': <_io.BytesIO object at 0x7f3a388ee050>,
  206. 'wsgi.multiprocess': True,
  207. 'wsgi.multithread': False,
  208. 'wsgi.run_once': False,
  209. 'wsgi.url_scheme': 'https',
  210. 'wsgi.version': (1, 0)}>
  211. self =
  212. <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>
  213. ModelForm = <class 'noc.services.web.apps.main.csv.views.ModelForm'>
  214. form =
  215. <noc.services.web.apps.main.csv.views.ModelForm object at 0x7f3a3890ccd0>
  216. ------------------------------------------------------------------------
  217. File: lib/app/site.py (Line: 230)
  218. Function: inner
  219. 223 for k, v in request.POST.lists())
  220. 224 elif request.method == "GET":
  221. 225 a = dict((k, v[0] if len(v) == 1 else v)
  222. 226 for k, v in request.GET.lists())
  223. 227 app_logger.debug("API %s %s %s",
  224. 228 request.method, request.path, a)
  225. 229 # Call handler
  226. 230 ==> r = v(request, *args, **kwargs)
  227. 231 # Dump SQL statements
  228. 232 if self.log_sql_statements:
  229. 233 from django.db import connections
  230. 234 tsc = 0
  231. 235 sc = defaultdict(int)
  232. 236 for conn in connections.all():
  233. Variables:
  234. args = ()
  235. view_map =
  236. {'DELETE': <bound method CSVApplication.view_index of <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>>,
  237. 'GET': <bound method CSVApplication.view_index of <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>>,
  238. 'POST': <bound method CSVApplication.view_index of <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>>,
  239. 'PUT': <bound method CSVApplication.view_index of <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>>}
  240. PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  241. DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  242. self = <noc.lib.app.site.Site object at 0x7f3a494d91d0>
  243. v =
  244. <bound method CSVApplication.view_index of <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>>
  245. request =
  246. <WSGIRequest
  247. path:/main/csv/,
  248. GET:<QueryDict: {}>,
  249. POST:<QueryDict: {u'action': [u'', u'Import'], u'model': [u'sa.ManagedObject']}>,
  250. COOKIES:{'noc_user': '2|1:0|10:1520917023|8:noc_user|8:YWRtaW4=|ac985a8d416a0f029afe096904571733e0fd0adc4d03abbd326ae0889a993982'},
  251. META:{'CONTENT_LENGTH': '44',
  252. 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
  253. 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
  254. 'HTTP_ACCEPT_ENCODING': 'gzip, br',
  255. 'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
  256. 'HTTP_CACHE_CONTROL': 'max-age=0',
  257. 'HTTP_CONNECTION': 'close',
  258. 'HTTP_COOKIE': 'noc_user="2|1:0|10:1520917023|8:noc_user|8:YWRtaW4=|ac985a8d416a0f029afe096904571733e0fd0adc4d03abbd326ae0889a993982"',
  259. 'HTTP_HOST': '10.220.21.122',
  260. 'HTTP_ORIGIN': 'https://10.220.21.122',
  261. 'HTTP_REFERER': 'https://10.220.21.122/main/csv/',
  262. 'HTTP_REMOTE_USER': 'admin',
  263. 'HTTP_UPGRADE_INSECURE_REQUESTS': '1',
  264. 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',
  265. 'HTTP_X_FORWARDED_FOR': '10.20.13.40',
  266. 'HTTP_X_FORWARDED_PROTO': 'https',
  267. 'HTTP_X_IMFORWARDS': '20',
  268. 'HTTP_X_REAL_IP': '10.20.13.40',
  269. 'HTTP_X_SCHEME': 'https',
  270. 'PATH_INFO': u'/main/csv/',
  271. 'QUERY_STRING': '',
  272. 'REMOTE_ADDR': '10.20.13.40',
  273. 'REQUEST_METHOD': 'POST',
  274. 'SCRIPT_NAME': u'',
  275. 'SERVER_NAME': '10.220.21.122',
  276. 'SERVER_PORT': '443',
  277. 'SERVER_PROTOCOL': 'HTTP/1.0',
  278. 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f3a599f51e0>,
  279. 'wsgi.input': <_io.BytesIO object at 0x7f3a388ee050>,
  280. 'wsgi.multiprocess': True,
  281. 'wsgi.multithread': False,
  282. 'wsgi.run_once': False,
  283. 'wsgi.url_scheme': 'https',
  284. 'wsgi.version': (1, 0)}>
  285. app_logger = <logging.Logger object at 0x7f3a39064650>
  286. InterfaceTypeError = <type 'exceptions.ValueError'>
  287. to_log_api_call = False
  288. kwargs = {}
  289. nq = <function nq at 0x7f3a388f59b0>
  290. app =
  291. <noc.services.web.apps.main.csv.views.CSVApplication object at 0x7f3a390642d0>
  292. ------------------------------------------------------------------------
  293. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement