%# James's moophelp update %# I have updated moophelp.py hardcode to support the following softcode %# changes and enhancements. I have implemented them in a separate object %# to simplify maintenance. You will need to manually add this object as %# a parent to which ever class of user you want to be able to access the %# help modification routines and move it where you want to put it. @create $thing as HelpDB %# First, a replacement for the $user.printHelp function @newfunc HelpDB.printHelp(self,topic='') if not topic: print 'Available help topics:' hlist = help() for topic in hlist: print " ", topic else: print 'Topic:', try: print topic except: print topic.name if type(topic) == InstanceType: if not topic.help: print help(topic.name) elif type(topic.help) == ListType or type(topic.help) == TupleType: print string.join(topic.help,'\n') else: print topic.help else: print help(topic) . @set HelpDB.printHelp.desc = "access the help database" %# Now the new functions and commands @newfunc HelpDB.at_helplist(self) print 'Help topics currently defined:' hlist = helplist(); hlist.sort() for topic in hlist: print " ", topic . @set HelpDB.at_helplist.desc = "print list of currently defined help topics" @cmd HelpDB.@helplist calls at_helplist() @newfunc HelpDB.at_addhelp(self,topic,what=None,p=None,initial=0) if not what and not p: helpadd(topic,initial=initial) else: text = getattr(what,p) helpadd(topic,text[0],string.join(text[1:], '\n'),initial) hSave() print "%s added to HelpDB" % topic . @set HelpDB.at_addhelp.desc = "add help topic" @cmd HelpDB.@addhelp calls at_addhelp(%1) @cmd HelpDB.@addhelp = . calls at_addhelp(%1,%2,%3) @cmd HelpDB.@addihelp calls at_addhelp(%1,None,None,1) @cmd HelpDB.@addihelp = . calls at_addhelp(%1,%2,%3,1) @newfunc HelpDB.at_delhelp(self,topic) if helpdel(topic): hSave() print '%s deleted from help database' % topic else: print 'Couldn't delete topic %s." % topic . @set HelpDB.at_delhelp.desc = "delete help topic" @cmd HelpDB.@delhelp calls at_delhelp(%1) @newfunc HelpDB.at_loadhelp(self) hLoad() . @set HelpDB.at_loadhelp.desc = "load help database" @cmd HelpDB.@loadhelp calls at_loadhelp() @newfunc HelpDB.at_savehelp(self) hSave() . @set HelpDB.at_savehelp.desc = "save help database" @cmd HelpDB.@savehelp calls at_savehelp()