Permalink
Browse files

Using Six

  • Loading branch information...
heynemann committed Apr 30, 2013
1 parent ce32ad2 commit c6a4dddaac54b7824e92830fad0a5f19bc38c14d
Showing with 8 additions and 10 deletions.
  1. +4 −8 derpconf/config.py
  2. +1 −0 requirements.txt
  3. +1 −0 tox.ini
  4. +2 −2 vows/config_vows.py
View
@@ -14,6 +14,7 @@
from os.path import join, exists, abspath, dirname
import imp
+import six
from textwrap import fill
@@ -69,10 +70,7 @@ def load(cls, path, conf_name=None, lookup_paths=[], defaults={}):
code = config_file.read()
module = imp.new_module(name)
- try:
- eval("exec code in module.__dict__")
- except SyntaxError:
- eval("exec(code, module.__dict__)")
+ six.exec_(code, module.__dict__)
conf = cls(defaults=defaults)
conf.config_file = path
@@ -94,10 +92,8 @@ def verify(cls, path):
name = 'configuration'
code = config_file.read()
module = imp.new_module(name)
- try:
- eval("exec code in module.__dict__")
- except SyntaxError:
- eval("exec(code, module.__dict__)")
+
+ six.exec_(code, module.__dict__)
conf = cls(defaults=[])
for name, value in module.__dict__.items():
View
@@ -3,3 +3,4 @@ tornado-pyvows
coverage
colorama
tox
+six
View
@@ -13,3 +13,4 @@ deps =
tornado-pyvows
coverage
colorama
+ six
View
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-# derpconf
+# derpconf
# https://github.com/globocom/derpconf
# Licensed under the MIT license:
@@ -16,6 +16,7 @@
fix = lambda name: abspath(join(dirname(__file__), 'fixtures', name))
+
@Vows.batch
class Configuration(Vows.Context):
class WhenLoading(Vows.Context):
@@ -117,4 +118,3 @@ def topic(self):
def should_be_lengthy(self, topic):
expect(topic).to_length(1)
-

0 comments on commit c6a4ddd

Please sign in to comment.