
olemis at gmail
May 7, 2009, 10:14 AM
Post #2 of 4
(455 views)
Permalink
|
|
Re: Dates & XML RPC plugin ... missing tickets changes
[In reply to]
|
|
On Tue, May 5, 2009 at 4:03 PM, Olemis Lang <olemis [at] gmail> wrote: > Hello I've experienced some issues while using XMLRPC plugin to > retrieve ticket changes. Well yesterday it was late at night and I discovered something crucial. It spins me right round and enlightened me a bit (a friend of mine told me that was the moon, but I'm smarter, I didnt believe him ... XD). Let's take a look at the datetime values once again : 2 new Date(2009,4,3,8,19,25) 'olemis' 'comment' '1' 'My extremely useful comment' true 2 new Date(2009,4,4,1,52,46) 'olemis' 'attachment' '' 'aaa.sql' false 2 new Date(2009,4,4,1,52,46) 'olemis' 'comment' '' 'AAaaaaaaa' false 2 new Date(2009,4,4,1,53,9) 'olemis' 'attachment' '' 'aaa.prj' false 2 new Date(2009,4,4,1,53,9) 'olemis' 'comment' '' 'Initialize me baby !' false In this case : {{{ >>> from xmlrpclib import ServerProxy >>> p = ServerProxy('http://localhost:8000/trac-dev/xmlrpc') >>> from datetime import datetime >>> p.ticket.getRecentChanges(datetime(2009,5,3,8,19,26)) [] >>> p.ticket.getRecentChanges(datetime(2009,5,3,8,19,25)) [2] >>> >>> p.ticket.changeLog(2, datetime(2009,5,3,8,19,25)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1147, in __call__ return self.__send(self.__name, args) File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1437, in __request verbose=self.__verbose File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1201, in request return self._parse_response(h.getfile(), sock) File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1340, in _parse_response return u.close() File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 787, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 2: "'cannot marshal <type 'generator'> objects' while executing 'ticket.changeLog()'"> }}} considering that : {{{ #! python # @tracrpc.ticket.TicketRPC def getRecentChanges(self, req, since): """Returns a list of IDs of tickets that have changed since timestamp.""" since = to_timestamp(since) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute('SELECT id FROM ticket' ' WHERE changetime >= %s', (since,)) result = [] for row in cursor: result.append(int(row[0])) return result }}} My conclusions : - It seems that once a «collateral change that is not yet immutable» (i.e. permanent=false as returned by tracrpc.ticket.TicketRPC.changeLog) is made then Trac doesnt update changetime column in the BD (tickets). - That's why the first call to getRecentChanges above returns an empty list, even if there are more recent changes. My Qs : - Is this statement true ? Is this behavior Ok ? IMHO & a-priori it shouldnt be so. - What about the traceback in p.ticket.changeLog ? Is it ok too ? - How can I (reliably) get all the changes made to tickets since a (well-known) date in the past, plus the tickets involved ? I would not like to go directly to the DB, since I'm planning (in the future, Mr Vader agreed in helping me, I just have to help him to conquer the world ... bah! piece of cake !) to get rid of all the relational SQL queries out there and use an ORM or something OO instead. Thnx in advance ;o) -- Regards, Olemis. Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: Here comes the Sun ... turu ruru. It's Oracle's ! - http://feedproxy.google.com/~r/simelo-es/~3/EMxV1KHhl60/here-comes-sun-turu-ruru-its-oracles.html --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users [at] googlegroups To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~----------~----~----~----~------~----~------~--~---
|