Commit facf5ff5 by murtaugh

wikifeedr

parent 08f37555
......@@ -98,7 +98,7 @@ def ensure_unique_wiki_pagename (wiki, name):
return name
n += 1
def upload_file_to_wiki (wiki, path, filename=None, description="", phpuploader=None):
def upload_file_to_wiki (wiki, path, filename=None, description="", phpuploader=None, user=None):
""" Takes a file path and ensures the file is uploaded to the wiki
Returns the wiki page object corresponding to the (previous) Image object
"""
......@@ -130,7 +130,12 @@ def upload_file_to_wiki (wiki, path, filename=None, description="", phpuploader=
print('[upload_file_to_wiki]: copying file to temporary directory', tmpdirname, file=sys.stderr)
shutil.copy(path, tpath)
print('[upload_file_to_wiki]: using importImages.php', tmpdirname, file=sys.stderr)
subprocess.call(["php", phpuploader, "--skip-dupes", "--comment", description, tmpdirname])
uargs = ["php", phpuploader, "--skip-dupes", "--comment", description]
if user != None:
uargs.append("--user")
uargs.append(user)
uargs.append(tmpdirname)
subprocess.call(uargs)
# TODO: ADD description / comment with link to containing item?! ... or source
# TODO: Using tmp.png is going to cause trouble!!!!
# shutil.move(tpath, path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment