Пример #1
0
 def __init__(self, ref=None):
     """
     @param ref: The schema reference being queried.
     @type ref: qref
     """
     Object.__init__(self)
     self.id = objid(self)
     self.ref = ref
     self.history = []
     self.resolved = False
     if not isqref(self.ref):
         raise Exception('%s, must be qref' % tostr(self.ref))
Пример #2
0
 def __init__(self, ref=None):
     """
     @param ref: The schema reference being queried.
     @type ref: qref
     """
     Object.__init__(self)
     self.id = objid(self)
     self.ref = ref
     self.history = []
     self.resolved = False
     if not isqref(self.ref):
         raise Exception('%s, must be qref' % tostr(self.ref))
Пример #3
0
 def builtin(self, ref, context=None):
     """
     Get whether the specified reference is an (xs) builtin.
     @param ref: A str or qref.
     @type ref: (str|qref)
     @return: True if builtin, else False.
     @rtype: bool
     """
     w3 = 'http://www.w3.org'
     try:
         if isqref(ref):
             ns = ref[1]
             return ref[0] in Factory.tags and ns.startswith(w3)
         if context is None:
             context = self.root
         prefix = splitPrefix(ref)[0]
         prefixes = context.findPrefixes(w3, 'startswith')
         return prefix in prefixes and ref[0] in Factory.tags
     except:
         return False
Пример #4
0
 def qualify(self):
     """
     Convert attribute values, that are references to other
     objects, into I{qref}.  Qualfied using default document namespace.
     Since many wsdls are written improperly: when the document does
     not define a default namespace, the schema target namespace is used
     to qualify references.
     """
     defns = self.root.defaultNamespace()
     if Namespace.none(defns):
         defns = self.schema.tns
     for a in self.autoqualified():
         ref = getattr(self, a)
         if ref is None:
             continue
         if isqref(ref):
             continue
         qref = qualify(ref, self.root, defns)
         log.debug('%s, convert %s="%s" to %s', self.id, a, ref, qref)
         setattr(self, a, qref)
Пример #5
0
 def builtin(self, ref, context=None):
     """
     Get whether the specified reference is an (xs) builtin.
     @param ref: A str or qref.
     @type ref: (str|qref)
     @return: True if builtin, else False.
     @rtype: bool
     """
     w3 = 'http://www.w3.org'
     try:
         if isqref(ref):
             ns = ref[1]
             return ref[0] in Factory.tags and ns.startswith(w3)
         if context is None:
             context = self.root
         prefix = splitPrefix(ref)[0]
         prefixes = context.findPrefixes(w3, 'startswith')
         return prefix in prefixes and ref[0] in Factory.tags
     except:
         return False
Пример #6
0
 def qualify(self):
     """
     Convert attribute values, that are references to other
     objects, into I{qref}.  Qualfied using default document namespace.
     Since many wsdls are written improperly: when the document does
     not define a default namespace, the schema target namespace is used
     to qualify references.
     """
     defns = self.root.defaultNamespace()
     if Namespace.none(defns):
         defns = self.schema.tns
     for a in self.autoqualified():
         ref = getattr(self, a)
         if ref is None:
             continue
         if isqref(ref):
             continue
         qref = qualify(ref, self.root, defns)
         log.debug('%s, convert %s="%s" to %s', self.id, a, ref, qref)
         setattr(self, a, qref)