summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-12-28 22:44:31 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-12-28 22:44:31 -0300
commitab83b6debaa5d0f3d5e73c991f8993dbac749e4f (patch)
tree911163b3c36022d8728d40e826f71840ed22557b
parent325251c0b3274d638c95fec82d84268432273df8 (diff)
downloadaskbot-ab83b6debaa5d0f3d5e73c991f8993dbac749e4f.tar.gz
askbot-ab83b6debaa5d0f3d5e73c991f8993dbac749e4f.tar.bz2
askbot-ab83b6debaa5d0f3d5e73c991f8993dbac749e4f.zip
added test for the absence of dot symbol in the directory name in the askbot-setup script
-rw-r--r--askbot/deployment/path_utils.py19
-rw-r--r--askbot/doc/source/changelog.rst2
-rw-r--r--askbot/doc/source/initial-configuration.rst11
3 files changed, 27 insertions, 5 deletions
diff --git a/askbot/deployment/path_utils.py b/askbot/deployment/path_utils.py
index e0704a96..ef260f86 100644
--- a/askbot/deployment/path_utils.py
+++ b/askbot/deployment/path_utils.py
@@ -230,14 +230,20 @@ def deploy_into(directory, new_project = False, verbosity = 1, context = None):
if verbosity >= 1:
print ''
-def dir_name_acceptable(directory):
+def dir_name_unacceptable_for_django_project(directory):
+ dir_name = os.path.basename(directory)
+ if re.match(r'[_a-zA-Z][\w-]*$', dir_name):
+ return False
+ return True
+
+def dir_taken_by_python_module(directory):
"""True if directory is not taken by another python module"""
dir_name = os.path.basename(directory)
try:
imp.find_module(dir_name)
- return False
- except ImportError:
return True
+ except ImportError:
+ return False
def get_install_directory(force = False):
"""returns a directory where a new django app/project
@@ -277,8 +283,13 @@ def get_install_directory(force = False):
if should_create_new == 'no':
return None
- if not dir_name_acceptable(directory):
+ if dir_taken_by_python_module(directory):
print messages.format_msg_bad_dir_name(directory)
return None
+ if dir_name_unacceptable_for_django_project(directory):
+ print """\nDirectory %s is not acceptable for a Django project.
+Please use lower case characters, numbers and underscore.
+The first character cannot be a number.\n""" % os.path.basename(directory)
+ return None
return directory
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index d69f4504..b0b39382 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -5,6 +5,8 @@ Development version (not released yet)
--------------------------------------
* added basic slugification treatment to question titles with
``ALLOW_UNICODE_SLUGS = True`` (Evgeny)
+* added verification of the project directory name to
+ make sure it does not contain a `.` (dot) symbol (Evgeny)
0.7.36 (Dec 20, 2011)
---------------------
diff --git a/askbot/doc/source/initial-configuration.rst b/askbot/doc/source/initial-configuration.rst
index 340324a1..7905aa1d 100644
--- a/askbot/doc/source/initial-configuration.rst
+++ b/askbot/doc/source/initial-configuration.rst
@@ -10,7 +10,16 @@ While most configuration settings for askbot can be done at any time :ref:`throu
Installing Askbot as a new Django project (standalone app)
==========================================================
-When installing Askbot for the first time, you will need to initialize the site setup files by typing::
+.. note::
+ Firstly - if you are preparing the project directory manually,
+ make sure that the directory name does not
+ have the `.` - dot - symbol, because it is illegal for Python modules.
+ For example::
+
+ mkdir mydjangosite
+ cd mydjangosite
+
+When installing Askbot for the first time, you will need to initialize the project setup files by typing::
askbot-setup