[ moin-Bugs-759282 ] util/datetime tmtuple invalid argument

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.web.wiki.moin.devel
Message-ID <[email protected]>
Bugs item #759282, was opened at 2003-06-23 17:25
Message generated for change (Comment added) made by thomaswaldmann
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108482&aid=759282&group_id=8482

Category: None
Group: None
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Scott Pascoe (s-pascoe)
Assigned to: Nobody/Anonymous (nobody)
Summary: util/datetime tmtuple invalid argument

Initial Comment:
Hi, I installed from CVS and found the following bug.  I'm 
running on Windows XP Pro with Python 2.2.3.

the "util/datetime.py" module defines tmtuple and 
passes an incorrect parameter to time.gmtime()

It is defined as 

return time.gmtime(tmsecs or time.time())

I tested and found that it should be

return time.gmtime(tmsecs + time.time())

Thanks,
Scott

----------------------------------------------------------------------

>Comment By: Thomas Waldmann (thomaswaldmann)
Date: 2003-11-19 18:16

Message:
Logged In: YES 
user_id=100649

Fixed in current cvs.

----------------------------------------------------------------------

Comment By: Scott Pascoe (s-pascoe)
Date: 2003-06-24 15:17

Message:
Logged In: YES 
user_id=511729

Your solution does correct the problem that I experienced. 
Thank you for your assistance.

Scott

----------------------------------------------------------------------

Comment By: Thomas Waldmann (thomaswaldmann)
Date: 2003-06-24 13:15

Message:
Logged In: YES 
user_id=100649

Try that fix (still dirty, but should work) and tell me, if
it works ok.

Index: PageEditor.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/PageEditor.py,v
retrieving revision 1.58
diff -u -r1.58 PageEditor.py
--- PageEditor.py       22 Jun 2003 17:11:36 -0000      1.58
+++ PageEditor.py       24 Jun 2003 11:12:54 -0000
@@ -780,7 +784,9 @@
 
         self.owner = None
         self.owner_html = cgi.escape(self._("<unknown>"))
-        self.timestamp = 0
+        self.timestamp = 43200 # avoiding exceptions!
+                               # was: 0 - but that gets
negative, if we
+                               # add users tz_offset (e.g.
-12h)
 
         if self.locktype:
             entry = editlog.loadLogEntry(self.request,
self._filename())


----------------------------------------------------------------------

Comment By: Scott Pascoe (s-pascoe)
Date: 2003-06-23 23:44

Message:
Logged In: YES 
user_id=511729

OK,  I put my code back to what came from CVS and 
attempted to edit the FrontPage of my wiki.  

It didn't fail as an anonymous user, or after I logged in.  I 
then changed my Date Format preference from "m/d/y" back 
to default and got the error traceback  as posted.

BTW, thanks for the quick responses.
Scott

----------------------------------------------------------------------

Comment By: Scott Pascoe (s-pascoe)
Date: 2003-06-23 23:30

Message:
Logged In: YES 
user_id=511729

Actually, I would have to agree completely.  

(I'm not a python programmer, and had to try a few more 
things before getting it to solve the problems exhibited.

My first fix caused an error in the PageEditor, so with a little 
more digging, I came up with this.

  if tmsecs is not None:
        return time.gmtime(tmsecs + time.time())
    else:
        return time.gmtime(time.time())

What do you think of that fix?  (probably not good Python, 
but it did solve the problem that I experienced.

Thanks, Scott

----------------------------------------------------------------------

Comment By: Thomas Waldmann (thomaswaldmann)
Date: 2003-06-23 19:27

Message:
Logged In: YES 
user_id=100649

Your "fix" is definitely incorrect.

It would help fixing the bug if you please post
the error msg you got from python, including traceback.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108482&aid=759282&group_id=8482


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.