Re: Logging failures (was Re: Comments again...)
walt <walt-76oD7HcvC/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
Okay, so I've gotten this far. I've added in an explicit log call to
getCommentCount just to test. With the code as-is I get the error
shown before:
File "/home/www/htdocs/plugins/comments.py", line 444, in cb_story
entry['num_comments'] = getCommentCount(entry, config)
File "/home/www/htdocs/plugins/comments.py", line 112, in
getCommentCount
tools.log("Verification log")
AttributeError: 'module' object has no attribute 'log'
However, if I copy the log creation call and associated lines into
getCommentCount, like so:
logdir = config.get("logdir", "/tmp/")
logfile = os.path.normpath(logdir + os.sep + "comments.log")
tools.make_logger(logfile)
print " tools file: %s" % tools.__file__
tools.log("Verification log")
then everything works fine. I stepped down the code and only if I have
all this in there does it work. Anything else will generate errors like
"global name 'logdir' is not defined".
So something is messed up with globals or cb_start() is not getting
called...
Hold the phone. I think I found the problem. The very first function
in comments.py is cb_start(). The very last function (with different
contents) is cb_start(). Methinks something is getting overridden.
When I move all log init lines into the last cb_start() def then
everything works as intended.
Might want to fix that for 1.0.1.
walt
On Thu, 3 Jun 2004, will guaraldi wrote:
> On Thu, 3 Jun 2004, walt wrote:
> >
> > Yes, I've set logdir and the path is correct. The permissions on the
> > log directory are the same as the permissions on the comments directory.
> > Since I can successfully create comments now I would assume that it
> > would also be able to write logs. I just tested the failure (by taking
> > away write permissions on the comment directory and trying to add a
> > comment) and I still get the same failure when it attempts to log.
>
> Well, if you say you have things set up correctly, I'm not sure what your
> issue might be.
>
>
> > Any chance you could toss that source tweak this way so I could give it
> > a quick whirl?
>
> "New" pyblosxom.py (just copy it over your existing
> pyblosxom/Pyblosxom/pyblosxom.py file) attached.
>
> /will
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504