Beispiel #1
0
 def test_from_module_instance(self):
     import settingsmodule
     cfg = config.from_object(settingsmodule)
     self.assertEqual(3, len(cfg))
     self.assertEqual('one', cfg['TEST_SETTING_1'])
     self.assertEqual('two', cfg['TEST_SETTING_2'])
     self.assertEqual(3, cfg['TEST_SETTING_3'])
Beispiel #2
0
class AppTodoMvc:

    main_html_file_path = 'static/template/index.html'
    config = config.from_object(Settings)

    def initialize(self, **kwargs):
        self.rdoc = kwargs['remote_document']
        self.datamodel = self.rdoc.new(DataModel)
        self.viewmodel = self.rdoc.new(ViewModel)
        self.rdoc.translate(Item)

        controller(self.rdoc, kwargs['main_html'], m=self.datamodel, vm=self.viewmodel,
                   prerender=self.datamodel.calc_completed_and_remaining)
class ThreeDEarth:

    include = [
        'https://rawgithub.com/mrdoob/three.js/master/build/three.min.js'
    ]
    config = config.from_object(__name__)

    def initialize(self, **kwargs):
        self.rdoc = kwargs['remote_document']
        self.rdoc.body.style(margin=0,
                             overflow='hidden',
                             backgroundColor='#000')
        self.earth = self.rdoc.new(Earth)
        self.rdoc.body.append(self.earth.renderer.domElement)

        self.rdoc.stylesheet.rule('a').style(color='#FFF')
        e = self.rdoc.body.element('p')
        e.prop.innerHTML = "Powered by <a href='https://github.com/skariel/webalchemy'>Webalchemy</a><br/>" +\
            "Adapted from <a href='https://github.com/turban/webgl-earth/blob/master/index.html'>this</a><br/>" +\
            "Pure Python source is <a href='https://github.com/skariel/webalchemy/blob/master/examples/three_d_earth/three_d_earth.py'>here</a>"
        e.style(color='#FFF', position='absolute', left='10px', top='10px')

        self.earth.render()
Beispiel #4
0
 def test_module_from_package(self):
     cfg = config.from_object('settings.module')
     self.assertEqual(3, len(cfg))
     self.assertEqual('one', cfg['TEST_SETTING_1'])
     self.assertEqual('two', cfg['TEST_SETTING_2'])
     self.assertEqual(3, cfg['TEST_SETTING_3'])
Beispiel #5
0
 def test_from_class(self):
     cfg = config.from_object('settingsmodule.TestSettings')
     self.assertEqual(3, len(cfg))
     self.assertEqual(1, cfg['TEST_SETTING_1'])
     self.assertEqual(2, cfg['TEST_SETTING_2'])
     self.assertEqual('three', cfg['TEST_SETTING_3'])