RE: DocUtils new version again
"Garth T Kidd" <garth-OnzZ1s1DREKDegMON/[email protected]> Tue, 21 Sep 2004 10:29:50 +1000
| Newsgroups | gmane.comp.pythin.pyds.devel |
|---|---|
| Organization | Deadly Bloody Serious |
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------=_NextPart_000_003A_01C49FC5.EF80DCF0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
I just re-rendered all my weblog and wiki posts with docutils-0.3.5, and it
worked just fine.
When shutting down, though, I got hit with a dozen of these:
Exception in thread Thread-5:
Traceback (most recent call last):
File "C:\Python23\lib\threading.py", line 436, in __bootstrap
self.run()
File "C:\Python23\lib\threading.py", line 416, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\dev\PyDS\PyDS\Tool.py", line 1333, in thunk
tool.logVerbose(_('Background process ended'))
File "C:\dev\PyDS\PyDS\Tool.py", line 1624, in logVerbose
getTool('events')._logVerbose(self.name, msg)
File "C:\dev\PyDS\PyDS\EventsTool.py", line 89, in _logVerbose
if not self.lock:
AttributeError: EventsTool instance has no attribute 'lock'
I've attached a fix in three parts: don't break, print incoming messages
after event tool shutdown to the console, and shutdown the event tool last.
The middle is handy if someone deletes the event tool lock attribute by
accident. Also in the patch are changes to the verbose upstreaming event log
and some verbosity in the FTP driver.
Regards,
Garth.
-----Original Message-----
From: pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected]
[mailto:pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected]] On Behalf Of Georg Bauer
Sent: Friday, 10 September 2004 7:20 AM
To: List PyDS
Subject: [Pyds-dev] DocUtils new version again
Hi!
Regarding this posting:
http://muensterland.org/users/0000078/weblog/2004/09/06.html#P3
there seems to be a new version of DocUtils out that doesn't work with PyDS.
Somebody (maybe some Garth ;-) ) may want to look into this?
bye, Georg
_______________________________________________
Pyds-dev mailing list
Pyds-dev-iYtK5bfT9M//Ad8WF/[email protected]
http://www.westfalen.de/cgi-bin/mailman/listinfo/pyds-dev
------=_NextPart_000_003A_01C49FC5.EF80DCF0
Content-Type: application/octet-stream;
name="20040921-1023-shutdownlogging.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="20040921-1023-shutdownlogging.diff"
Index: PyDS/EventsTool.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /pyds/PyDS/PyDS/EventsTool.py,v
retrieving revision 1.39
diff -c -r1.39 EventsTool.py
*** PyDS/EventsTool.py 20 Sep 2004 12:49:58 -0000 1.39
--- PyDS/EventsTool.py 21 Sep 2004 00:16:42 -0000
***************
*** 60,66 ****
self.showCalendar =3D 0
=20
def _log(self, tool, message, error=3D0):
! if not self.lock:
return # Tool already shut down - no more logging
try:
self._acquire()
--- 60,66 ----
self.showCalendar =3D 0
=20
def _log(self, tool, message, error=3D0):
! if not hasattr(self, 'lock') or self.lock is None:
return # Tool already shut down - no more logging
try:
self._acquire()
***************
*** 86,95 ****
finally: self._release()
=09
def _logVerbose(self, tool, message):
! if not self.lock:
! return # Tool already shut down - no more logging
! if self.getPref('verbose') or _PyDS.verbose:
! self._log(tool, message)
=20
def _status(self):
try:
--- 86,101 ----
finally: self._release()
=09
def _logVerbose(self, tool, message):
! if not hasattr(self, 'lock') or self.lock is None:
! if not hasattr(self, 'loggingAfterShutdown'):=20
! self.loggingAfterShutdown =3D 1
! msg =3D "Log messages received after events tool shut down:"
! dashes =3D '-' * len(msg)
! print "%s\n%s\n%s" % (dashes, msg, dashes)
! print "%s: %s" % (tool, message)
! else:=20
! if self.getPref('verbose') or _PyDS.verbose:
! self._log(tool, message)
=20
def _status(self):
try:
Index: PyDS/FTPDriver.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /pyds/PyDS/PyDS/FTPDriver.py,v
retrieving revision 1.8
diff -c -r1.8 FTPDriver.py
*** PyDS/FTPDriver.py 30 Jul 2004 08:02:50 -0000 1.8
--- PyDS/FTPDriver.py 25 Aug 2004 21:23:25 -0000
***************
*** 4,10 ****
=20
Copyright (c) 2002, Georg Bauer <gb-BRhJDZTO+/[email protected]>
=20
! Permission is hereby granted, free of charge, to any person obtaining =
a copy of=20
this software and associated documentation files (the "Software"), to =
deal in=20
the Software without restriction, including without limitation the =
rights to=20
use, copy, modify, merge, publish, distribute, sublicense, and/or sell =
copies of
--- 4,10 ----
=20
Copyright (c) 2002, Georg Bauer <gb-BRhJDZTO+/[email protected]>
=20
! Permission is hereby granted, free of charge, to any /rson obtaining a =
copy of=20
this software and associated documentation files (the "Software"), to =
deal in=20
the Software without restriction, including without limitation the =
rights to=20
use, copy, modify, merge, publish, distribute, sublicense, and/or sell =
copies of
***************
*** 231,248 ****
--- 231,252 ----
=09
# this method deletes multiple files on the cloud
def deleteMultipleFiles(self, files):
+ debugOutput =3D PyDS.Tool.debugOutput
tool =3D self.tool
server =3D FTP(tool.get('driver', 'server'))
server.login(
tool.get('driver', 'user'),
tool.get('driver', 'password')
)
+ debugOutput("FTP: logged in to %s" % tool.get('driver', 'server'))
for fn in files:
fullname =3D os.path.join(tool.get('driver', 'path'), =
fn).replace(os.sep, '/')
+ debugOutput("FTP: deleting %s..." % fullname)
server.delete(fullname)
tool.set('status', 'deletes', tool.get('status', 'deletes') + 1)
for path in files:
tool.deleteFileStatus(path)
+ debugOutput("FTP: end delete run.")
return getDummyResult()
=09
# this method upstreams files with given contents without keeping =
track of
***************
*** 309,315 ****
url +=3D fn.replace(os.sep, '/')
liste.append(url)
tool.set('status', 'lastupstream', time.ctime())
! debugOutput("FTP: done all.")
return getDummyResult(urlList=3Dliste)
=20
registerDriver('FTP', _('FTP Driver'), FTPDriver)
--- 313,319 ----
url +=3D fn.replace(os.sep, '/')
liste.append(url)
tool.set('status', 'lastupstream', time.ctime())
! debugOutput("FTP: end upstream run.")
return getDummyResult(urlList=3Dliste)
=20
registerDriver('FTP', _('FTP Driver'), FTPDriver)
Index: PyDS/Server.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /pyds/PyDS/PyDS/Server.py,v
retrieving revision 1.86
diff -c -r1.86 Server.py
*** PyDS/Server.py 14 Sep 2004 20:55:51 -0000 1.86
--- PyDS/Server.py 21 Sep 2004 00:23:02 -0000
***************
*** 211,224 ****
request.error(401)
return
=09
def terminate(signal=3D"(API shutdown)", param=3DNone):
"""Signal handler for the pycs daemon. Applicable
only to those systems implementing POSIX signals.
"""
=20
PyDS.Tool.log(_('The server is shutting down'))
# first stage shutdown, only stop background threads
! for tool in PyDS.Tool.getTools():
if hasattr(tool, '_shutdown'):
try:
tool._shutdown()
--- 211,235 ----
request.error(401)
return
=09
+ def toolsWithEventsLast():=20
+ """Return a list of tools with the events tool last.
+ Copes with the events tool not existing, just in case."""
+ tools =3D PyDS.Tool.getTools()
+ eventsTools =3D [tool for tool in tools if tool.name =3D=3D 'events']
+ tools =3D [tool for tool in tools if tool.name !=3D 'events']
+ tools.extend(eventsTools)
+ return tools
+=20
def terminate(signal=3D"(API shutdown)", param=3DNone):
"""Signal handler for the pycs daemon. Applicable
only to those systems implementing POSIX signals.
"""
=20
PyDS.Tool.log(_('The server is shutting down'))
+ tools =3D toolsWithEventsLast()
+ =09
# first stage shutdown, only stop background threads
! for tool in tools:
if hasattr(tool, '_shutdown'):
try:
tool._shutdown()
***************
*** 227,233 ****
PyDS.Tool.mainstatus.running(0)
# second stage shutdown, stop the background threads
PyDS.Tool.dispatcher.stop()
! for tool in PyDS.Tool.getTools():
if hasattr(tool, '_remove'):
try:
tool._remove()
--- 238,244 ----
PyDS.Tool.mainstatus.running(0)
# second stage shutdown, stop the background threads
PyDS.Tool.dispatcher.stop()
! for tool in tools:
if hasattr(tool, '_remove'):
try:
tool._remove()
Index: PyDS/UpstreamTool.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /pyds/PyDS/PyDS/UpstreamTool.py,v
retrieving revision 1.103
diff -c -r1.103 UpstreamTool.py
*** PyDS/UpstreamTool.py 17 Mar 2004 11:01:35 -0000 1.103
--- PyDS/UpstreamTool.py 25 Aug 2004 23:10:53 -0000
***************
*** 289,294 ****
--- 289,297 ----
if not(maxsize):
maxsize =3D 100000
(tosave, todel) =3D self.getChangeSet()
+ def frep(files):=20
+ reps =3D [re.sub(r'\\', '/', f) for f in files]
+ return '<ul><li>%s</li></ul>' % '</li><li>'.join(reps)
if len(tosave):
dosave =3D []
savesize =3D 0
***************
*** 301,314 ****
if len(dosave) > 25:
dosave =3D dosave[:25]
self._awakeUpstream =3D 1
! self.log(_('about to save: %s'), dosave)
self.saveMultipleFiles(dosave)
if len(todel):
todel =3D map(lambda r: r[0], todel)
if len(todel) > 25:
todel =3D todel[:25]
self._awakeUpstream =3D 1
! self.log(_('about to delete: %s'), todel)
self.deleteMultipleFiles(todel)
if len(tosave) or len(todel) and not(self._awakeUpstream):
self.logVerbose(_('work done, going to sleep again'))
--- 304,317 ----
if len(dosave) > 25:
dosave =3D dosave[:25]
self._awakeUpstream =3D 1
! self.log(_('about to save: %s'), frep(dosave))
self.saveMultipleFiles(dosave)
if len(todel):
todel =3D map(lambda r: r[0], todel)
if len(todel) > 25:
todel =3D todel[:25]
self._awakeUpstream =3D 1
! self.log(_('about to delete: %s'), frep(todel))
self.deleteMultipleFiles(todel)
if len(tosave) or len(todel) and not(self._awakeUpstream):
self.logVerbose(_('work done, going to sleep again'))
Index: PyDS/WikiTool.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /pyds/PyDS/PyDS/WikiTool.py,v
retrieving revision 1.27
diff -c -r1.27 WikiTool.py
*** PyDS/WikiTool.py 4 Aug 2004 10:56:36 -0000 1.27
--- PyDS/WikiTool.py 18 Aug 2004 02:41:27 -0000
***************
*** 366,372 ****
self.pathprefix(),
_('This node is a template node')
))
! html.append('<a href=3D"%(url)s" =
title=3D"%(lastmod)s">%(id)s</a>: %(title)s' % nodevars)
else:=20
html.append('%s' % k)
if hashedChildren:=20
--- 366,375 ----
self.pathprefix(),
_('This node is a template node')
))
! if node.title:=20
! html.append('<a href=3D"%(url)s" =
title=3D"%(lastmod)s">%(title)s</a>' % nodevars)
! else:=20
! html.append('<a href=3D"%(url)s" =
title=3D"%(lastmod)s">%(id)s</a>' % nodevars)
else:=20
html.append('%s' % k)
if hashedChildren:=20
***************
*** 946,952 ****
cursor =3D base
for seg in segs:=20
cursor =3D cursor.setdefault(seg, {})
- PyDS.Tool.debugOutput("RSN: %s" % repr(base))
def spit(out, baseids, cursor, depthLimit, depth=3D1):=20
ids =3D cursor.keys()
ids.sort()
--- 949,954 ----
------=_NextPart_000_003A_01C49FC5.EF80DCF0--