Ejemplo n.º 1
0
    def test_singleton(self):
        from rctk.resourceregistry import getResourceRegistry

        rr1 = getResourceRegistry()
        rr2 = getResourceRegistry()

        assert rr1 is rr2
Ejemplo n.º 2
0
 def serve(self, name):
     # serve a app-specific, dynamic resource
     if name.startswith('dynamic/'):
         elements = name.split('/')
         resource = getResourceRegistry().get_resource(elements[1], elements)
         return (resource.type, resource.data)
     raise KeyError(name)
Ejemplo n.º 3
0
 def index_html(cls):
     """ return the main index.html template """
     import rctk.zk.resources
     path = os.path.join(cls.workingdir(), 'main.html')
     tpl = open(path, "r").read()
     header = getResourceRegistry().header()
     return tpl.replace('<!-- rctk-header -->', header)
Ejemplo n.º 4
0
 def index_html(cls):
     """ return the main index.html template """
     import rctk.zk.resources
     path = os.path.join(cls.workingdir(), 'main.html')
     tpl = open(path, "r").read()
     header = getResourceRegistry().header()
     return tpl.replace('<!-- rctk-header -->', header)
Ejemplo n.º 5
0
 def index_html(cls):
     ## basically the same as serve_static("/media/index.html")[1]
     header = getResourceRegistry().header()
     tpl = open(os.path.join(cls.workingdir(), "source/index.html"), "r").read()
     return tpl.replace('<!-- rctk-header -->', header)
Ejemplo n.º 6
0
 def __init__(self, tk):
     self.rr = getResourceRegistry()
     self.tk = tk
Ejemplo n.º 7
0
 def serve_resource(cls, name):
     # name starts with resource/
     elements = name.split('/')
     resource = getResourceRegistry().get_resource(elements[1], elements)
     return (resource.type, resource.data)