85 self.description=kwd.description |
85 self.description=kwd.description |
86 |
86 |
87 |
87 |
88 |
88 |
89 class Method(Link): |
89 class Method(Link): |
90 def __init__(self,name,title): |
90 def __init__(self,name,methods): |
|
91 title=name[0].upper()+name[1:] |
91 Link.__init__(self,name,title) |
92 Link.__init__(self,name,title) |
92 m=user_methods[name] |
93 m=methods[name] |
|
94 self.func_line=inspect.formatargspec(*inspect.getargspec(m)) |
93 self.description = m.__doc__.split("\n")[0] |
95 self.description = m.__doc__.split("\n")[0] |
94 a=inspect.getargspec(m) |
96 a=inspect.getargspec(m) |
95 self.args=[Arg(a,m) for a in a.args if a is not "self"] |
97 self.args=[Arg(a,m) for a in a.args if a is not "self"] |
96 _, self.rets=ret(m) |
98 _, self.rets=ret(m) |
97 |
99 |
101 Site("current.html","API Documentation"), |
103 Site("current.html","API Documentation"), |
102 Site("new.html","geplante API Documentation"), |
104 Site("new.html","geplante API Documentation"), |
103 Site("impressum.html","Impressum"), |
105 Site("impressum.html","Impressum"), |
104 ] |
106 ] |
105 |
107 |
106 methods=[ |
108 current_methods = dict(inspect.getmembers(Current(None,None))) |
107 Method("startSMS","StartSMS"), |
109 current=[ |
108 Method("startFAX","StartFAX"), |
110 Method("startSMS",current_methods), |
109 Method("startMail","StartMail"), |
111 Method("startFAX",current_methods), |
|
112 Method("startMail",current_methods), |
110 |
113 |
111 Method("status","Status"), |
114 Method("status",current_methods), |
112 Method("stop","Stop"), |
115 Method("stop",current_methods), |
113 |
116 |
114 Method("getProvider","GetProvider"), |
117 Method("getProvider",current_methods), |
115 Method("getDefaultProvider","GetDefaultProvider"), |
118 Method("getDefaultProvider",current_methods), |
116 ] |
119 ] |
|
120 |
|
121 new_methods = dict(inspect.getmembers(New())) |
|
122 newm=[ |
|
123 Method("sms",new_methods), |
|
124 Method("fax",new_methods), |
|
125 Method("mail",new_methods), |
|
126 |
|
127 Method("status",new_methods), |
|
128 Method("stop",new_methods), |
|
129 |
|
130 Method("routes",new_methods), |
|
131 Method("defaultRoute",new_methods), |
|
132 ] |
|
133 |
|
134 |
117 for site in sites: |
135 for site in sites: |
118 print("generiere %s" % site.name) |
136 print("generiere %s" % site.name) |
119 tmpl = loader.load(site.name) |
137 tmpl = loader.load(site.name) |
120 def a(s): |
138 def a(s): |
121 if s == site: |
139 if s == site: |
122 return {"class":"menu active"} |
140 return {"class":"menu active"} |
123 stream = tmpl.generate(sites=sites,active=a,methods=methods) |
141 stream = tmpl.generate(sites=sites,active=a,current=current,new=newm) |
124 with open('doc/'+site.name, "w") as g: |
142 with open('doc/'+site.name, "w") as g: |
125 g.write(stream.render('html', doctype='html')) |
143 g.write(stream.render('html', doctype='html')) |
126 |
144 |
127 if __name__ == '__main__': |
145 if __name__ == '__main__': |
128 main() |
146 main() |