Bug with editing attachments
Vladimir Prus
ghost at cs.msu.su
Thu Nov 20 12:09:38 UTC 2003
Hello,
using CVS HEAD of QMTest, I have problems with attachments.
Case 1. An existing test has 'core.qms/test4.itrace' as location for
attachment. When I click "OK" button on editing page, without editing
attachment at all, QMTest creates new attachment with the same name, location
and so on, but in temporary attachments store. Note that it does not really
creates the data in temporary attachment store, when when saving Attachment
to the attachment store associated with the xml_database, I get exception.
Case 2. I create new test with attachment. The location of attachment is
computed as:
/home/ghost/Work/Module/nm_model/tdb/jamconfig
And that's really unfortunate. I don't get any exceptions, since when
temporary attachment store joins its locations with this absolute path, it
gets valid path. But, when saving, a new file is created, with name
/home/ghost/Work/Module/nm_model/tdb/jamconfig.2
And the number is incremented on all subsequent saves -- and the data is just
duplicated.
I think the issues which must be solved are:
1. Some way to remove attachments which are no longer used. Is there any way
for attachment to be used by two tests? If not, it should be simple to find
which attachment fields are used by the saved tests, and which are modified.
2. I think the logic of XMLDatabase.__MakeDataFilePath somewhat breaks
encapsulation of attachment store. Instead of directly doing os.path.exists,
there should be some method in FileAttachmentStore (or, better yet, in
AttachmentStore), which allows to check if location is used or not.
3. Finally, when creating Attachment from form data, we need to know, if it's
attachment in the origianal attachment store of XMLDatabase -- which happens
if the user has not modified attachment, or it if's in the temporary
attachment store -- which happends if new attachment was uploaded. Currently,
the second case is assumed, which causes the first problem.
Thoughts? If the above makes sense I can try to do something about it.
- Volodya
More information about the qmtest
mailing list