| Index: cms/sources.py |
| =================================================================== |
| --- a/cms/sources.py |
| +++ b/cms/sources.py |
| @@ -67,6 +67,16 @@ |
| config.readfp(StringIO(configdata)) |
| return config |
| + def import_symbol(self, filename, symbol): |
| + code = self.read_file(filename) |
| + namespace = {} |
|
Sebastian Noack
2015/05/20 16:01:39
Note that I refactored this logic while moving it
|
| + exec code in namespace |
| + |
| + try: |
| + return namespace[symbol] |
| + except KeyError: |
| + raise Exception("Expected symbol %s not found in %s" % (symbol, filename)) |
| + |
| # |
| # Page helpers |
| # |