def _create_classifer(self, request, context):
     try:
         client.policyclassifier_create(request, **context)
         return True
     except Exception as e:
         msg = self.format_status_message(self.failure_message) + str(e)
         exceptions.handle(request, msg)
         return False
 def _create_classifer(self, request, context):
     try:
         client.policyclassifier_create(request, **context)
         return True
     except Exception as e:
         msg = self.format_status_message(self.failure_message) + str(e)
         exceptions.handle(request, msg)
         return False
Beispiel #3
0
 def _create_classifer(self, request, context):
     try:
         if context.get('name'):
             context['name'] = html.escape(context['name'])
         if context.get('description'):
             context['description'] = html.escape(context['description'])
         client.policyclassifier_create(request, **context)
         return True
     except Exception as e:
         msg = self.format_status_message(self.failure_message) + str(e)
         exceptions.handle(request, msg)
         return False
 def _create_classifer(self, request, context):
     try:
         if context.get('name'):
             context['name'] = html.escape(context['name'])
         if context.get('description'):
             context['description'] = html.escape(context['description'])
         client.policyclassifier_create(request, **context)
         return True
     except Exception as e:
         msg = self.format_status_message(self.failure_message) + str(e)
         exceptions.handle(request, msg)
         return False
 def handle(self, request, context):
     url = reverse("horizon:project:application_policy:index")
     try:
         if not bool(context["port_range"]):
             context["port_range"] = None
         classifier = client.policyclassifier_create(request, **context)
         messages.success(request, _("Policy Classifier successfully created."))
         return classifier
     except Exception:
         exceptions.handle(request, _("Unable to create policy classifier."), redirect=url)
Beispiel #6
0
 def handle(self, request, context):
     url = reverse('horizon:project:application_policy:index')
     try:
         if not bool(context['port_range']):
             context['port_range'] = None
         classifier = client.policyclassifier_create(request, **context)
         messages.success(
             request, _('Policy Classifier successfully created.'))
         return classifier
     except Exception:
         exceptions.handle(
             request, _("Unable to create policy classifier."),
             redirect=url)
 def handle(self, request, context):
     url = reverse('horizon:project:application_policy:index')
     try:
         if context.get('protocol') in PROTOCOL_MAP:
             context['protocol'] = PROTOCOL_MAP[context['protocol']]
         if not context.get('port_range'):
             context['port_range'] = None
         if context.get('name'):
             context['name'] = html.escape(context['name'])
         classifier = client.policyclassifier_create(request, **context)
         messages.success(
             request, _('Policy Classifier successfully created.'))
         return classifier
     except Exception:
         exceptions.handle(
             request, _("Unable to create policy classifier."),
             redirect=url)
Beispiel #8
0
 def handle(self, request, context):
     url = reverse('horizon:project:application_policy:index')
     try:
         protocol = context.get('protocol').lower()
         if protocol in PROTOCOL_MAP:
             context['protocol'] = PROTOCOL_MAP[protocol]
         elif protocol == "any":
             del context['protocol']
         if not context.get('port_range'):
             context['port_range'] = None
         if context.get('name'):
             context['name'] = html.escape(context['name'])
         classifier = client.policyclassifier_create(request, **context)
         messages.success(
             request, _('Policy Classifier successfully created.'))
         return classifier
     except Exception:
         exceptions.handle(
             request, _("Unable to create policy classifier."),
             redirect=url)