author | Alberto Bertogli
<albertito@gmail.com> 2007-12-31 14:44:28 UTC |
committer | Alberto Bertogli
<albertito@gmail.com> 2007-12-31 14:44:28 UTC |
parent | 4c3e7ac3c9ed8e9d7ddb6b31e5909d401031f132 |
config.py.sample | +5 | -3 |
wikiri.cgi | +12 | -4 |
diff --git a/config.py.sample b/config.py.sample index b0d9e7d..6c5eb71 100644 --- a/config.py.sample +++ b/config.py.sample @@ -23,7 +23,9 @@ css_url = wiki_url + "/style" # Wiki title. title = "I like wikis" -# History backend. Can be "none" for no history, or "git" to use git (needs -# git and "git init" to be called on the data path). -history = "none" +# History backend. Can be one of: +# - "none" for no history +# - "git" to use git (needs git and the data path to be a repository) +# - "auto" to select automatically (looks if the data path is a repository) +history = "auto" diff --git a/wikiri.cgi b/wikiri.cgi index d3f2850..ca7f2fb 100755 --- a/wikiri.cgi +++ b/wikiri.cgi @@ -28,9 +28,12 @@ css_url = wiki_url + "/style" # Wiki title. title = "I like wikis" -# History backend. Can be "none" for no history, or "git" to use git (needs -# git and "git init" to be called on the data path). -history = "none" +# History backend. Can be one of: +# - "none" for no history +# - "git" to use git (needs git and the data path to be a repository) +# - "auto" to select automatically (looks if the data path is a repository) +history = "auto" + # # End of configuration @@ -630,7 +633,12 @@ class HistoryError (Exception): class History: def __init__(self): - if history == 'git': + if history == 'auto': + if os.path.isdir(data_path + '.git'): + self.be = GitBackend(data_path) + else: + self.be = NoneBackend(data_path) + elif history == 'git': self.be = GitBackend(data_path) else: self.be = NoneBackend(data_path)