Skip to content

Commit 61282e9

Browse files
committed
Remove 'import *' statement from test/memorydb.py
It is generally best to avoid 'import *' statements, particularly in this case where objects in the global namespace are being propagated through to an execfile(). The construction of the 'vars' variable is a bit of a hack, but preferable to the alternative. Sometime in the future it may be a good idea to do away with using execfile() to parse the schema files.
1 parent 9882a9e commit 61282e9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/memorydb.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
'''
33

44
import shutil
5+
import os
56

7+
from roundup import date
68
from roundup import hyperdb
79
from roundup import roundupdb
810
from roundup import security
@@ -12,7 +14,6 @@
1214
from roundup.backends import indexer_dbm
1315
from roundup.backends import sessions_dbm
1416
from roundup.backends import indexer_common
15-
from roundup.hyperdb import *
1617
from roundup.support import ensureParentsExist
1718

1819
def new_config(debug=False):
@@ -32,7 +33,10 @@ def create(journaltag, create=True, debug=False):
3233
# load standard schema
3334
schema = os.path.join(os.path.dirname(__file__),
3435
'../share/roundup/templates/classic/schema.py')
35-
vars = dict(globals())
36+
vars = hyperdb.__dict__
37+
vars['Class'] = Class
38+
vars['FileClass'] = FileClass
39+
vars['IssueClass'] = IssueClass
3640
vars['db'] = db
3741
execfile(schema, vars)
3842
initial_data = os.path.join(os.path.dirname(__file__),

0 commit comments

Comments
 (0)