--- a/createdoc.py Tue Dec 06 19:46:00 2011 +0100
+++ b/createdoc.py Tue Dec 06 23:53:18 2011 +0100
@@ -7,10 +7,10 @@
import re
import inspect
-from iro.user import User
+from iro.user import User as Current
+from iro.newuser import User as New
-user_methods = dict(inspect.getmembers(User(None,None)))
class Link():
def __init__(self,name,title):
@@ -47,7 +47,7 @@
if kw:
ret[kw.name]=kw
li.append(kw)
- l=re.match(r"^(?P<name>[a-zA-Z0-9-_.]*)\[(?P<typ>[a-zA-Z0-9-_]*)\]:(?P<d>.*)$",line)
+ l=re.match(r"^(?P<name>[a-zA-Z0-9-_.]*)\[(?P<typ>[a-zA-Z0-9-_|]*)\]:(?P<d>.*)$",line)
kw=Keyword(name=l.group("name"),typ=l.group("typ"),description=l.group("d"))
else:
kw.description+="\n"+line.strip()
@@ -87,9 +87,11 @@
class Method(Link):
- def __init__(self,name,title):
+ def __init__(self,name,methods):
+ title=name[0].upper()+name[1:]
Link.__init__(self,name,title)
- m=user_methods[name]
+ m=methods[name]
+ self.func_line=inspect.formatargspec(*inspect.getargspec(m))
self.description = m.__doc__.split("\n")[0]
a=inspect.getargspec(m)
self.args=[Arg(a,m) for a in a.args if a is not "self"]
@@ -103,24 +105,40 @@
Site("impressum.html","Impressum"),
]
- methods=[
- Method("startSMS","StartSMS"),
- Method("startFAX","StartFAX"),
- Method("startMail","StartMail"),
+ current_methods = dict(inspect.getmembers(Current(None,None)))
+ current=[
+ Method("startSMS",current_methods),
+ Method("startFAX",current_methods),
+ Method("startMail",current_methods),
+
+ Method("status",current_methods),
+ Method("stop",current_methods),
- Method("status","Status"),
- Method("stop","Stop"),
+ Method("getProvider",current_methods),
+ Method("getDefaultProvider",current_methods),
+ ]
+
+ new_methods = dict(inspect.getmembers(New()))
+ newm=[
+ Method("sms",new_methods),
+ Method("fax",new_methods),
+ Method("mail",new_methods),
- Method("getProvider","GetProvider"),
- Method("getDefaultProvider","GetDefaultProvider"),
+ Method("status",new_methods),
+ Method("stop",new_methods),
+
+ Method("routes",new_methods),
+ Method("defaultRoute",new_methods),
]
+
+
for site in sites:
print("generiere %s" % site.name)
tmpl = loader.load(site.name)
def a(s):
if s == site:
return {"class":"menu active"}
- stream = tmpl.generate(sites=sites,active=a,methods=methods)
+ stream = tmpl.generate(sites=sites,active=a,current=current,new=newm)
with open('doc/'+site.name, "w") as g:
g.write(stream.render('html', doctype='html'))