Advertisement
Guest User

Untitled

a guest
Oct 15th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. root@noc:/opt/noc # hg diff
  2. diff -r 9e45c6372597 fm/apps/classificationrule/js/TestForm.js
  3. --- a/fm/apps/classificationrule/js/TestForm.js Fri Oct 11 07:42:44 2013 +0400
  4. +++ b/fm/apps/classificationrule/js/TestForm.js Tue Oct 15 13:49:46 2013 +0400
  5. @@ -56,7 +56,8 @@
  6. //
  7. onTest: function() {
  8. var me = this,
  9. - data = me.dataField.getValue();
  10. + data = me.dataField.getValue(),
  11. + fd = me.app.getFormData();
  12. // @todo: Validation
  13. Ext.Ajax.request({
  14. url: "/fm/classificationrule/test/",
  15. @@ -65,7 +66,7 @@
  16. jsonData: {
  17. data: data,
  18. patterns: me.app.getPatterns(),
  19. - event_class: me.app.currentRecord.get("event_class")
  20. + event_class: fd["event_class"]
  21. },
  22. success: function(response) {
  23. var me = this;
  24. diff -r 9e45c6372597 fm/apps/classificationrule/views.py
  25. --- a/fm/apps/classificationrule/views.py Fri Oct 11 07:42:44 2013 +0400
  26. +++ b/fm/apps/classificationrule/views.py Tue Oct 15 13:49:46 2013 +0400
  27. @@ -40,7 +40,7 @@
  28. patterns = []
  29. result = False
  30. # Get data
  31. - data = None
  32. + data = {}
  33. vars = {}
  34. required_vars = set()
  35. r_patterns = []
  36. @@ -57,7 +57,11 @@
  37. errors += ["Event not found: %s" % q["data"]]
  38. else:
  39. # Decode json
  40. - e = self.deserialize(q["data"])
  41. + try:
  42. + e = self.deserialize(q["data"])
  43. + except:
  44. + errors += ["Cannot decode JSON"]
  45. + e = None
  46. if isinstance(e, list):
  47. e = e[0]
  48. if not isinstance(e, dict) or "raw_vars" not in e:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement