import wizard
from wizard import shell, util
-def fill_url(dir, url=None):
+def fill_url(dir, url=None, old_style=False):
"""
Attempts to determine the URL a directory would be web-accessible at.
If ``url`` is specified, automatically use it.
# try the directory
homedir, _, web_path = dir.partition("/web_scripts")
if web_path:
- return urlparse.ParseResult(
- "http",
- util.get_dir_owner(homedir) + ".scripts.mit.edu",
- web_path.rstrip('/'),
- "", "", "")
+ if old_style:
+ return urlparse.ParseResult(
+ "http",
+ "scripts.mit.edu",
+ "/~" + util.get_dir_owner(homedir) + web_path.rstrip('/'),
+ "", "", "")
+ else:
+ return urlparse.ParseResult(
+ "http",
+ util.get_dir_owner(homedir) + ".scripts.mit.edu",
+ web_path.rstrip('/'),
+ "", "", "")
# try the environment
host = os.getenv("WIZARD_WEB_HOST")
if not os.path.join(root, name).startswith(dir + excluded_dir):
file = os.path.join(root, name)
try:
+ if os.path.islink(file): continue
sum_sizes += os.path.getsize(file)
except OSError as e:
if e.errno == errno.ENOENT: