|
|
|
Issue 8 of
buildit_issues
[BUILDIT]
|
| Title: |
allow global variables to be passed in to Context ctor
|
| Status: |
Pending
|
Security |
related:
No
|
| Description: |
I find it useful to pass in some variables programmatically so that they are available for interpretation in global sections:
from buildit.context im...
|
| From: |
Jeff Hammel
|
on: |
Jul 30, 07 15:51
|
| |
Anonymous User
|
Last update:
|
~
|
| Topic/class: |
Zope/feature+solution
|
Importance:
|
medium
|
| Version info: |
buildit 1.0 |
|
Issue 8 Transcript
|
|
1 entry
|
= Request - Entry #1 by Anonymous User on Jul 30, 2007 3:51 pm
I find it useful to pass in some variables programmatically so that they are available for interpretation in global sections:
from buildit.context import Context
from StringIO import StringIO
c = StringIO('[globals]\nfleem = flarg\nbaz=${foo}\n')
context = Context(c, global_variables={'foo': 'bar'})
print context.globals
Here is a patch to context.py to do this:
@@ -45,7 +45,7 @@
_resolved = None
def __init__(self, inifile, buildoutdir=None, logger=None,
- namespace_overrides=None):
+ namespace_overrides=None, global_variables=None):
if buildoutdir is None:
# assume that the caller is the main makefile
@@ -59,6 +59,10 @@
'buildoutdir':buildoutdir,
'platform':platform
}
+
+ if global_variables is None:
+ global_variables = {}
+ builtins.update(global_variables)
self.inifile = inifile
self.globals = builtins
|
|
|