Refactored
This commit is contained in:
parent
8dffa86490
commit
feccbd6242
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue