Message3296
I'd like to be able to write admin scripts which rewrite
msg content -- for example, to fixup "issue 23"
to "issue23", or to fix up "http://oldserver/stuff"
to "http://newserver/stuff".
I can do this by grovelling around in the db/files/msg
directory of the tracker, but this feels quite dirty -- it'd
feel cleaner to be able to do it through the hyperdb API.
However, while I can get msg content:
>>> db.msg.get("216", "content")
"old"
I can't set msg content:
>>> db.msg.set("216", content="new")
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\Lib\site-
packages\roundup\backends\rdbms_common.py", line
1308, in set
raise KeyError, '"%s" has no property named "%s"'%(
KeyError: '"msg" has no property named "content"'
In the RDBMS backends, the "content" property is
special-cased on create and get to read/write from file;
but it's not special-cased on set. (I think this is also the
case in the other backends.)
Can go lower-level to get the content directly from the
file, although this does make an assumption on how files
are named:
>>> db.getfile("msg", "216", "")
"old"
and can attempt to change the content:
>> db.storefile("msg", "216", "", "new")
but this fails on commit:
>>> db.commit()
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\Lib\site-
packages\roundup\backends\rdbms_common.py", line
813, in commit
reindex[method(*args)] = 1
File "C:\Python23\Lib\site-
packages\roundup\backends\blobfiles.py", line 115, in
doStoreFile
os.rename(name+".tmp", name)
OSError: [Errno 17] File exists
|
|
Date |
User |
Action |
Args |
2009-02-03 14:23:49 | admin | link | issue914062 messages |
2009-02-03 14:23:49 | admin | create | |
|