Esempio n. 1
0
 def _wrapped(*args, **kwargs):
     if 'domain' in kwargs:
         domain = kwargs['domain']
     elif (len(args) > 2 and isinstance(args[0], View)
           and isinstance(args[1], HttpRequest)
           and isinstance(args[2], six.string_types)):
         soft_assert_type_text(args[2])
         # class-based view; args == (self, request, domain, ...)
         domain = args[2]
     elif (len(args) > 1 and isinstance(args[0], HttpRequest)
           and isinstance(args[1], six.string_types)):
         soft_assert_type_text(args[1])
         # view function; args == (request, domain, ...)
         domain = args[1]
     else:
         domain = None
     if _soft_assert(
             domain,
             'Unable to track_domain_request("{prop}") on view "{view}". Unable to determine domain from '
             'args {args}.'.format(prop=calculated_prop,
                                   view=view_func.__name__,
                                   args=args)):
         DomainAuditRecordEntry.update_calculations(
             domain, calculated_prop)
     return view_func(*args, **kwargs)
Esempio n. 2
0
 def _wrapped(*args, **kwargs):
     if 'domain' in kwargs:
         domain = kwargs['domain']
     elif (
             len(args) > 2 and
             isinstance(args[0], View) and
             isinstance(args[1], HttpRequest) and
             isinstance(args[2], six.string_types)
     ):
         soft_assert_type_text(args[2])
         # class-based view; args == (self, request, domain, ...)
         domain = args[2]
     elif (
             len(args) > 1 and
             isinstance(args[0], HttpRequest) and
             isinstance(args[1], six.string_types)
     ):
         soft_assert_type_text(args[1])
         # view function; args == (request, domain, ...)
         domain = args[1]
     else:
         domain = None
     if _soft_assert(
             domain,
             'Unable to track_domain_request("{prop}") on view "{view}". Unable to determine domain from '
             'args {args}.'.format(prop=calculated_prop, view=view_func.__name__, args=args)
     ):
         DomainAuditRecordEntry.update_calculations(domain, calculated_prop)
     return view_func(*args, **kwargs)
Esempio n. 3
0
 def _wrapped(class_based_view, request, *args, **kwargs):
     domain = kwargs.get("domain", None)
     if domain:
         DomainAuditRecordEntry.update_calculations(
             domain, calculated_prop)
     return view_func(class_based_view, request, *args, **kwargs)
Esempio n. 4
0
 def _wrapped(class_based_view, request, *args, **kwargs):
     domain = kwargs.get("domain", None)
     if domain:
         DomainAuditRecordEntry.update_calculations(domain, calculated_prop)
     return view_func(class_based_view, request, *args, **kwargs)