Esempio n. 1
0
class Resource(Element):
    xmltagname = 'resource'
    id = String.T(optional=True, xmlstyle='attribute')
    type = String.T(optional=True, xmlstyle='attribute')
    query_type = String.T(default='application/x-www-form-urlencoded',
                          optional=True,
                          xmlstyle='attribute')
    path = String.T(optional=True, xmlstyle='attribute')
    doc_list = List.T(Doc.T())
    param_list = List.T(Param.T())
    method_list = List.T(Method.T())
    resource_list = List.T(Defer('Resource.T'))

    def iter_resources(self):
        yield self.path, self
        for res in self.resource_list:
            yield self.path + '/' + res.path, res

    def iter_methods(self):
        for method in self.method_list:
            method = method.deref()
            yield method

    def describe(self, indent):
        lines = []
        for met in self.iter_methods():
            lines.extend(met.describe('  ' + indent))

        return lines

    def get_children(self):
        return self.param_list + self.method_list + self.resource_list
Esempio n. 2
0
 class A(Object):
     a = Defer('B.T')
     b = Int.T(default=0)
Esempio n. 3
0
 class A(Object):
     a = Defer('A.T', optional=True)
Esempio n. 4
0
 class A(Object):
     p = List.T(Defer('B.T'))
     q = List.T(Defer('B.T'))
Esempio n. 5
0
 class A(Object):
     p = Defer('B.T', optional=True)