Roundup Tracker - Issues

Issue 2051107

classification
hyperdb.exportFilename() has error?
Type: Severity: normal
Components: None Versions:
process
Status: closed rejected
:
: : broader, richard, rouilj
Priority: normal :

Created on 2008-08-14 09:13 by broader, last changed 2016-06-26 22:27 by rouilj.

Messages
msg2579 Author: [hidden] (broader) Date: 2008-08-14 09:13
I'm using roundup as backend to construct a GUI program.
When call the hyperdb.exportFilename() method,it returns incorrect file path.

the old code is :
 return os.path.join(dirname, self.classname+'-files', subdir_filename)

when I change this line to the below:
 return os.path.join(dirname, 'files',self.classname, subdir_filename)
the result is right.
So I think that it's maybe a bug?

The running environment:
OS: Ubuntun 7.10
Python: 2.5.1
roundup: 1.4.4
msg2580 Author: [hidden] (richard) Date: 2008-08-18 05:14
Sorry, export works for me. You'll need to be more specific about what sort of error you're getting.
msg2581 Author: [hidden] (broader) Date: 2008-08-19 14:28
In my ubuntu/linux environment, I has a roundup instance whose directory is :
/home/broader/roundup/data
and a hyperdb.FileClass instance whose name is 'crecord' is located as below:
/home/broader/roundup/data/db/files/crecord
When call the hyperdb.exportFilename() method,it returns a incorrect file
path as below:
/home/broader/roundup/data/db/crecord-files/0/crecordx
but the right path should be :
/home/broader/roundup/data/db/files/crecord/0/crecordx

So, I think its maybe a bug,because in roundup all the hyperdb.FileClass instances will be saved to ../files/(classname)/(0...)/classname(0~...) , not ../classname-files/(0...)/classname(0~...) 
By the way, I have tested it on Windows environment(XP/python2.5.2/roundup1.4.5.1) also, and got the same result as on Linux/Ubuntu.

Best Regards!
msg5638 Author: [hidden] (rouilj) Date: 2016-06-26 22:27
That function doesn't do what you think it does.

To get path to the file in the tracker that sotres
file contents use: self.db.filename as below (from hyperdb.py):

    def export_files(self, dirname, nodeid):
        """ Export the "content" property as a file, not csv column
        """
        source = self.db.filename(self.classname, nodeid)

        dest = self.exportFilename(dirname, nodeid)
        ensureParentsExist(dest)
        shutil.copyfile(source, dest)

exportFilename is used to generate the *target* destination
path for the exported directory.

What you want is self.db.filename given the class and nodeid.
History
Date User Action Args
2016-06-26 22:27:21rouiljsetstatus: open -> closed
resolution: works for me -> rejected
messages: + msg5638
nosy: + rouilj
2008-08-14 09:13:05broadercreate