|
[Webware-checkins] r2362 - WSGIKit/trunk/wsgikit
From: <ianb@co...> - 2005-04-21 06:59
|
Author: ianb
Date: 2005-04-21 00:59:34 -0600 (Thu, 21 Apr 2005)
New Revision: 2362
Modified:
WSGIKit/trunk/wsgikit/app_setup.py
Log:
Keep track of the server configuration filename
Modified: WSGIKit/trunk/wsgikit/app_setup.py
===================================================================
--- WSGIKit/trunk/wsgikit/app_setup.py 2005-04-21 06:20:42 UTC (rev 2361)
+++ WSGIKit/trunk/wsgikit/app_setup.py 2005-04-21 06:59:34 UTC (rev 2362)
@@ -22,10 +22,11 @@
-t or --template option (but ignores all other options), and if
none then looks in server.conf for a template_name option.
- Returns template_name, template_dir, module
+ Returns server_conf_fn, template_name, template_dir, module
"""
template_name = None
template_name, rest = find_template_option(args)
+ server_conf_fn = None
if template_name:
next_template_name, rest = find_template_option(rest)
if next_template_name:
@@ -34,7 +35,7 @@
'(first I found %r, then %r)'
% (template_name, next_template_name))
else:
- template_name = find_template_config(args)
+ server_conf_fn, template_name = find_template_config(args)
if not template_name:
raise InvalidCommand(
'No template given (provide --template=name or run this command '
@@ -48,7 +49,7 @@
except ImportError, e:
raise InvalidCommand(
'No template exists by the name %r (%s)' % (template_name, e))
- return (template_name, os.path.dirname(template_mod.__file__), template_mod)
+ return (server_conf_fn, template_name, os.path.dirname(template_mod.__file__), template_mod)
def find_template_option(args):
copy = args[:]
@@ -73,7 +74,7 @@
return None
conf = pyconfig.Config()
conf.load(conf_fn)
- return conf.get('template_name')
+ return conf_fn, conf.get('app_template')
def load_template(template_name):
base = os.path.join(os.path.dirname(__file__), 'app_templates')
@@ -89,11 +90,11 @@
def run(args):
try:
- name, dir, mod = find_template_info(args)
+ server_conf_fn, name, dir, mod = find_template_info(args)
except InvalidCommand, e:
print str(e)
return 2
- return mod.run(args, name, dir, mod)
+ return mod.run(args, name, dir, mod, server_conf_fn)
class CommandRunner(object):
@@ -102,7 +103,9 @@
self.command_aliases = {}
self.register_standard_commands()
- def run(self, argv, template_name, template_dir, template_module):
+ def run(self, argv, template_name, template_dir, template_module,
+ server_conf_fn):
+ self.server_conf_fn = server_conf_fn
invoked_as = argv[0]
args = argv[1:]
for i in range(len(args)):
@@ -280,8 +283,11 @@
max_args = 1
def command(self):
- if args:
- self.runner.run([self.invoked_as, self.args[0], '-h'])
+ if self.args:
+ self.runner.run([self.invoked_as, self.args[0], '-h'],
+ self.template_name, self.template_dir,
+ self.template_module,
+ self.runner.server_conf_fn)
else:
print 'Available commands:'
print ' (use "%s help COMMAND" or "%s COMMAND -h" ' % (
|
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] r2362 - WSGIKit/trunk/wsgikit | <ianb@co...> |