[Repoze-dev] docstring format

Chris McDonough chrism at plope.com
Wed Sep 12 23:29:29 UTC 2007


An example of using a specially formatted docstring so we can parse  
out short API docs:

     def readLog(self, offset, length):
         """ Read length bytes from the main log starting at offset

         @param int offset         offset to start reading from.
         @param int length         number of bytes to read from the log.
         @return string result     Bytes of log
         """
         self._update('readLog')

         logfile = self.supervisord.options.logfile

         if logfile is None or not os.path.exists(logfile):
             raise RPCError(Faults.NO_FILE, logfile)

         try:
             return readFile(logfile, int(offset), int(length))
         except ValueError, inst:
             why = inst.args[0]
             raise RPCError(getattr(Faults, why))

_______________________________________________
Repoze-dev mailing list
Repoze-dev at lists.repoze.org
http://lists.repoze.org/mailman/listinfo/repoze-dev



More information about the Repoze-dev mailing list