]>
gitweb.michael.orlitzky.com - dead/pictar.git/blob - Configuration/__init__.py
10 rel_script_path
= sys
.argv
[0]
11 abs_script_path
= os
.path
.abspath(rel_script_path
)
12 abs_script_dir
= os
.path
.dirname(abs_script_path
)
17 def GetBrowserCommand():
18 # Get the command used to execute the user's browser.
19 return Defaults
.BROWSER_COMMAND
22 def GetAbsTargetDir():
23 rel_target_dir
= os
.getcwd()
27 # If no directory was passed to the program,
28 # use the current working directory as the target.
29 # Otherwise, use the passed directory.
30 rel_target_dir
= sys
.argv
[1]
32 # Convert a relative path into an absolute one.
33 # It will be important to have an absolute path
34 # later when we are constructing URLs.
35 __abs_target_dir
= os
.path
.abspath(rel_target_dir
)
37 return __abs_target_dir
42 def GetPageTemplatePath():
43 script_dir
= GetPictarDir()
44 page_template_path
= os
.path
.join(script_dir
, Defaults
.PAGE_TEMPLATE_FILE_NAME
)
46 return page_template_path
57 unique_string
= str(time
.time())
58 md5hash
= md5
.new(unique_string
)
59 outfile_name
= md5hash
.hexdigest()
60 outfile_path
= os
.path
.join(tempfile
.gettempdir(), outfile_name
)
69 def GetItemTemplatePath():
70 script_dir
= GetPictarDir()
71 item_template_path
= os
.path
.join(script_dir
, Defaults
.ITEM_TEMPLATE_FILE_NAME
)
73 return item_template_path
77 def GetStyleSheetPath():
78 script_dir
= GetPictarDir()
79 stylesheet_path
= os
.path
.join(script_dir
, Defaults
.STYLESHEET_FILE_NAME
)
81 return stylesheet_path
89 def GetMimetypesFilePath():
90 script_dir
= GetPictarDir()
91 mimetypes_file_path
= os
.path
.join(script_dir
, Defaults
.MIMETYPES_FILE_NAME
)
93 return mimetypes_file_path