Ejemplo n.º 1
0
        def __init__(self, function):
            WebMethodDescriptor.__init__(self, function, of_type,
                                         ('POST', client, lang, qs),
                                         'application/json', encoding, None,
                                         None, None)
            if allowed_origins:
                from porcupine import context
                from porcupine import filters

                @filters.runas('system')
                @webmethod(of_type=of_type,
                           http_method="OPTIONS",
                           content_type="text/plain",
                           max_age=-1)
                def __blank__(self):
                    origin = WebMethod._getAccessControlAllowOrigin(
                        allowed_origins, context)
                    if origin:
                        allowheaders = (context.request.
                                        HTTP_ACCESS_CONTROL_REQUEST_HEADERS)
                        if not allowheaders:
                            allowheaders = "*"
                        context.response.set_header(
                            "Access-Control-Allow-Origin", origin)
                        context.response.set_header(
                            "Access-Control-Allow-Headers", allowheaders)
                        context.response.set_header(
                            "Access-Control-Allow-Methods",
                            "POST, GET, OPTIONS")
                        context.response.set_header(
                            "Cache-Control", "no-cache")
 def __init__(self, function):
     WebMethodDescriptor.__init__(self, function, of_type,
         ('GET',
          '(MSIE [6-7].+Windows NT)|(Mozilla/5.0.+rv:1.[7-9])|Version/3.\d(.*)Safari|Chrome/\d.\d',
          lang,
          qs),
         'text/xml', encoding, max_age, template, template_engine)
Ejemplo n.º 3
0
 def __init__(self, function):
     WebMethodDescriptor.__init__(self, function, of_type,
         ('GET',
          '(MSIE (?:[6-9]|10).+Windows NT)|' +
          '(Mozilla/5\.0.+rv:(1\.[7-9]|2\.\d|(?:[5-9]|1[0-9])\.\d))|' +
          'Version/[3-5]\.\d(.*)Safari|' +
          'Chrome/(\d)+\.(\d)+|' +
          'Opera/9',
          lang,
          qs),
         'text/xml', encoding, max_age, template, template_engine)
Ejemplo n.º 4
0
 def __init__(self, function):
     WebMethodDescriptor.__init__(self, function, of_type,
                                  (http_method, client, lang, qs),
                                  content_type, encoding, max_age,
                                  template, template_engine)
Ejemplo n.º 5
0
 def __init__(self, function):
     WebMethodDescriptor.__init__(self, function, of_type,
         ('GET', 'PMB|UNTRUSTED', lang, qs),
         'text/xml', encoding, max_age, template, template_engine)
 def __init__(self, function):
     WebMethodDescriptor.__init__(self, function, of_type,
                                  ('POST', client, lang, qs),
                                  'application/json', encoding, None,
                                  None, None)
 def __init__(self, function):
     WebMethodDescriptor.__init__(self, function, of_type,
                                  ('POST', client, lang, qs),
                                  'text/xml', encoding, None,
                                  None, None)
 def __init__(self, function):
     WebMethodDescriptor.__init__(self, function, of_type,
         ('GET', '(MSIE [6-7])|(Mozilla/5.0.+rv:1.[7-9])', lang, qs),
         'text/xml', encoding, max_age, template, template_engine)