예제 #1
0
    def test_singleton(self):
        from rctk.resourceregistry import getResourceRegistry

        rr1 = getResourceRegistry()
        rr2 = getResourceRegistry()

        assert rr1 is rr2
예제 #2
0
파일: toolkit.py 프로젝트: dimitrs/rctk
 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)
예제 #3
0
파일: frontend.py 프로젝트: dimitrs/rctk.zk
 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)
예제 #4
0
파일: frontend.py 프로젝트: dimitrs/rctk.zk
 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)
예제 #5
0
파일: frontend.py 프로젝트: rctk/rctk.qx
 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)
예제 #6
0
파일: frontend.py 프로젝트: dimitrs/rctk
 def __init__(self, tk):
     self.rr = getResourceRegistry()
     self.tk = tk
예제 #7
0
파일: frontend.py 프로젝트: dimitrs/rctk
 def serve_resource(cls, name):
     # name starts with resource/
     elements = name.split('/')
     resource = getResourceRegistry().get_resource(elements[1], elements)
     return (resource.type, resource.data)