[Checkins] SVN: grokproject/trunk/src/grokproject/ Add a question for the initial module name when creating a grok sandbox. This is a

Philipp von Weitershausen philikon at philikon.de
Fri Jan 26 09:26:41 EST 2007


Log message for revision 72234:
  Add a question for the initial module name when creating a grok sandbox.  This is a
  preliminary fix for https://launchpad.net/grok/+bug/80403.
  

Changed:
  U   grokproject/trunk/src/grokproject/__init__.py
  A   grokproject/trunk/src/grokproject/template/src/+package+/+module+.py_tmpl
  A   grokproject/trunk/src/grokproject/template/src/+package+/+module+_templates/
  D   grokproject/trunk/src/grokproject/template/src/+package+/+module+_templates/README.txt_tmpl
  D   grokproject/trunk/src/grokproject/template/src/+package+/+package+.py_tmpl
  D   grokproject/trunk/src/grokproject/template/src/+package+/+package+_templates/
  U   grokproject/trunk/src/grokproject/template/src/+package+/README.txt_tmpl

-=-
Modified: grokproject/trunk/src/grokproject/__init__.py
===================================================================
--- grokproject/trunk/src/grokproject/__init__.py	2007-01-26 12:29:28 UTC (rev 72233)
+++ grokproject/trunk/src/grokproject/__init__.py	2007-01-26 14:26:41 UTC (rev 72234)
@@ -10,11 +10,23 @@
     required_templates = []
 
     vars = [
+        var('module', 'Name of an demo Python module placed into the package',
+            default=NoDefault),
         var('user', 'Name of an initial administrator user', default=NoDefault),
         var('passwd', 'Password for the initial administrator user',
             default=NoDefault),
         ]
 
+    def check_vars(self, vars, cmd):
+        vars = super(GrokProject, self).check_vars(vars, cmd)
+        module = vars['module']
+        if '.' in module:
+            if module.endswith('.py'):
+                vars['module'] = module[:-3]
+            else:
+                raise command.BadCommand('Bad module name: %s' % module)
+        return vars
+
 def main():
     usage = "usage: %prog [options] PROJECT"
     parser = optparse.OptionParser(usage=usage)

Copied: grokproject/trunk/src/grokproject/template/src/+package+/+module+.py_tmpl (from rev 71881, grokproject/trunk/src/grokproject/template/src/+package+/+package+.py_tmpl)

Copied: grokproject/trunk/src/grokproject/template/src/+package+/+module+_templates (from rev 71881, grokproject/trunk/src/grokproject/template/src/+package+/+package+_templates)

Deleted: grokproject/trunk/src/grokproject/template/src/+package+/+module+_templates/README.txt_tmpl
===================================================================
--- grokproject/trunk/src/grokproject/template/src/+package+/+package+_templates/README.txt_tmpl	2007-01-10 17:09:34 UTC (rev 71881)
+++ grokproject/trunk/src/grokproject/template/src/+package+/+module+_templates/README.txt_tmpl	2007-01-26 14:26:41 UTC (rev 72234)
@@ -1,2 +0,0 @@
-Place Page Templates (file extension '.pt') in this directory.  They
-will automatically be associated as views with the model in ${package}.py.
\ No newline at end of file

Deleted: grokproject/trunk/src/grokproject/template/src/+package+/+package+.py_tmpl
===================================================================
--- grokproject/trunk/src/grokproject/template/src/+package+/+package+.py_tmpl	2007-01-26 12:29:28 UTC (rev 72233)
+++ grokproject/trunk/src/grokproject/template/src/+package+/+package+.py_tmpl	2007-01-26 14:26:41 UTC (rev 72234)
@@ -1,5 +0,0 @@
-import grok
-
-class ${project}(grok.Model):
-    pass
-

Modified: grokproject/trunk/src/grokproject/template/src/+package+/README.txt_tmpl
===================================================================
--- grokproject/trunk/src/grokproject/template/src/+package+/README.txt_tmpl	2007-01-26 12:29:28 UTC (rev 72233)
+++ grokproject/trunk/src/grokproject/template/src/+package+/README.txt_tmpl	2007-01-26 14:26:41 UTC (rev 72234)
@@ -1,8 +1,8 @@
 Put your application code in this Python package.
 
-${package}_templates
+${module}_templates
   Place Page Templates (file extension '.pt') in this directory.  They
-  will automatically be associated as views with the model in ${package}.py.
+  will automatically be associated as views with the model in ${module}.py.
 
 static
   Place static resources such as CSS, JS, images, etc. in here.



More information about the Checkins mailing list