Example #1
0
def setup(app, blueprints=None):
    if blueprints is None:
        blueprints = DEFAULT_BLUEPRINTS

    configure_logging(app)
    configure_blueprints(app, blueprints)
    # configure_error_handlers(app)
    inject.inject(app)
    os.environ['SCRIPT_NAME'] = app.config['SCRIPT_NAME']
Example #2
0
def setup(app, blueprints=None):
    if blueprints is None:
        blueprints = DEFAULT_BLUEPRINTS

    configure_logging(app)
    configure_blueprints(app, blueprints)
    # configure_error_handlers(app)
    inject.inject(app)
    os.environ['SCRIPT_NAME'] = app.config['SCRIPT_NAME']
Example #3
0
    def plumberinject(function, data):
        result = inject(function, data)

        if hasattr(result, 'keys') and hasattr(result, '__getitem__'):
            # a mapping
            data.update(result)
        elif hasattr(result, '__iter__'):
            # assume a iterator with tuples of two values [(k, v), (k, v), ...]
            data.update(result)
        else:
            data[function.__name__] = result

        return data
Example #4
0
from statusbar import StatusBar
from styledtextbox import StyledTextBox
from systemsettings import SystemSettings
from textbox import TextBox
from textentrydialog import TextEntryDialog
from timer import Timer
from treelistview import TreeListView
from treeview import TreeView
from waxconfig import WaxConfig
from waxobject import WaxObject

if sys.platform != 'darwin':
    from togglebutton import ToggleButton
    # doesn't exist on the Mac?
    from sound import Sound
if sys.platform == 'win32':
    from taskbaricon import TaskBarIcon

# behavior injection
# XXX maybe this can be handled by the MetaWaxObject?
import types
classes = [
    obj for obj in globals().values()
    if type(obj) is types.ClassType and issubclass(obj, WaxObject)
]
import inject
inject.inject(classes)

del types, inject, classes, obj
# we don't need these in the Wax namespace
Example #5
0
from simpleeditor import SimpleEditor
from splitter import Splitter
from statusbar import StatusBar
from styledtextbox import StyledTextBox
from systemsettings import SystemSettings
from textbox import TextBox
from textentrydialog import TextEntryDialog
from timer import Timer
from treelistview import TreeListView
from treeview import TreeView
from waxconfig import WaxConfig
from waxobject import WaxObject

if sys.platform != 'darwin':
    from togglebutton import ToggleButton
    # doesn't exist on the Mac?
    from sound import Sound
if sys.platform in ('win32', 'linux2'):
    from taskbaricon import TaskBarIcon

# behavior injection
# XXX maybe this can be handled by the MetaWaxObject?
import types
classes = [obj for obj in globals().values()
           if type(obj) is types.ClassType and issubclass(obj, WaxObject)]
import inject
inject.inject(classes)

del types, inject, classes, obj
# we don't need these in the Wax namespace
Example #6
0
def test_inject_apply():
    def foo():
        return locals()

    assert inject(a=5).into(foo) == {'a': 5}
Example #7
0
def test_inject_apply():

    def foo():
        return locals()

    assert inject(a=5).into(foo) == {'a': 5}