1
0
Fork 0

Refactored

This commit is contained in:
Daniele Tricoli 2007-03-12 03:33:20 +00:00
parent 8dffa86490
commit feccbd6242
1 changed files with 5 additions and 3 deletions

View File

@ -19,8 +19,10 @@ def uploadfile(trac_env_dir, file_dir, upload_page):
cur = con.cursor()
for f in os.listdir(file_dir):
if os.path.isfile(os.path.join(file_dir, f)):
size = os.stat(f)[6]
file_to_upload = os.path.join(file_dir, f)
if os.path.isfile(file_to_upload):
size = os.stat(file_to_upload)[6]
q = """INSERT INTO attachment (type, id, filename, size, time,
description, author, ipnr) values
(?, ?, ?, ?, ?, ?, ?, ?) """
@ -29,7 +31,7 @@ def uploadfile(trac_env_dir, file_dir, upload_page):
'trac-wikifileuploader', '127.0.0.1'))
con.commit()
shutil.copyfile(os.path.join(file_dir, f),
shutil.copyfile(file_to_upload,
os.path.join(trac_env_dir,
'attachments',
'wiki',