#35 closed task (fixed)
In trac 0.11 email2trac fails in notify and in ticket_update methods
Reported by: | andrei2102@… | Owned by: | bas |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | email2trac | Version: | 0.1 |
Keywords: | Cc: |
Description
I started to port this script for trac 0.11 and I founded two errors.
The first is in the notify method and it is described in the #34 ticket. The solution, for me, was to remove the hack.
# create false {abs_}href properties, to trick Notify() # self.env.abs_href = Href(self.get_config('project', 'url')) self.env.href = Href(self.get_config('project', 'url'))
The env members(abs_href and href) don't need to be overwritten.
The second problem was that in ticket_modify method. When saving the modifications made on a ticket it was passed an integer as the modification time.
Traceback (most recent call last): File "/home/andrei/workspace/etf/trunk/share/bin/email2trac.py", line 1062, in ? tktparser.parse(file('/tmp/tests/tm.eml', 'r')) File "/home/andrei/workspace/etf/trunk/share/bin/email2trac.py", line 663, in parse if self.ticket_update(m): File "/home/andrei/workspace/etf/trunk/share/bin/email2trac.py", line 542, in ticket_update tkt.save_changes(self.author, body_text, when) File "/home/andrei/workspace/etf/trunk/vendor/trac-0.11dev/trac/ticket/model.py", line 207, in save_changes when_ts = to_timestamp(when) File "/home/andrei/workspace/etf/trunk/vendor/trac-0.11dev/trac/util/datefmt.py", line 55, in to_timestamp diff = dt - _epoc TypeError: unsupported operand type(s) for -: 'int' and 'datetime.datetime'
In trac 0.11 if the modification time is None then datetime.now() is assumed. So the solution is to send a None.
A patch is attached.
Attachments (2)
Change History (12)
Changed 15 years ago by andrei2102@…
comment:1 Changed 15 years ago by bas
- Status changed from new to assigned
Thanks for the patch i will apply it and adjust it so that it also will work for versions not equal to 0.11.
So we can close ticket #34?
comment:2 Changed 15 years ago by andrei2102@…
yes i think that the #34 ticket can be closed
comment:3 Changed 15 years ago by anonymous
- Type changed from defect to task
Patch applied to trunk for:
# create false {abs_}href properties, to trick Notify() # self.env.abs_href = Href(self.get_config('project', 'url')) self.env.href = Href(self.get_config('project', 'url'))
The date part was already fixed by some else.
Can you test the trunk version?
comment:4 Changed 15 years ago by andrei2102@…
The version that I tested and in which I found the bug is the version from the trunk, version that isn't modified for two months.
comment:5 Changed 15 years ago by bas
Andrei,
That is not what i meant. I forgot to commit the patch yesterday but i have commited your patch + one from somenody else to the trunk version today. The question is can you test this new trunk version?
Regards
comment:6 Changed 15 years ago by andrei2102@…
I started testing the new version after changeset [192] but there are 2 problems:
- the code in the strip_quotes method is not properly indented (maybe using 4 spaces for a tab should be better)
- at line 838 it should be
if not self.VERSION == 0.11: self.env.abs_href = Href(self.get_config('project', 'url')) self.env.href = Href(self.get_config('project', 'url'))
not self.version
With this changes I'm testing the rest of the code.
I'll upload a patch with the changes.
comment:7 Changed 15 years ago by anonymous
Thanks a lot will be applied to trunk. This were stupid mistakes. Sorry
comment:8 Changed 15 years ago by andrei2102@…
I tested the code and it works fine.
comment:9 Changed 15 years ago by anonymous
oke thanks, i will close the ticket if a release a new version
comment:10 Changed 14 years ago by anonymous
- Resolution set to fixed
- Status changed from assigned to closed
New version will be released soon
diff file with the fixes