コード例 #1
0
ファイル: Index.py プロジェクト: jpunwin/tums
 def document(self):
     baseDir = self.enamel.Settings.BaseDir
     theme = self.enamel.Settings.theme
     self.child_css = static.File('%s/themes/%s/css/' % (baseDir, theme))
     self.child_js  = compression.CompressingResourceWrapper(static.File(baseDir + '/js/'))
     self.child_images = compression.CompressingResourceWrapper(static.File('%s/themes/%s/images/' % (baseDir, theme)))
     return pages.template('login.xml', templateDir='%s/themes/%s/templates/' % (baseDir, theme))
コード例 #2
0
 def document(self):
     baseDir = self.enamel.Settings.BaseDir
     theme = self.enamel.Settings.theme
     # Images, javascript and CSS locations
     # derived from base directory and theme
     self.child_css = static.File('%s/themes/%s/css/' % (baseDir, theme))
     self.child_js = compression.CompressingResourceWrapper(
         static.File(baseDir + '/js/'))
     self.child_images = compression.CompressingResourceWrapper(
         static.File('%s/themes/%s/images/' % (baseDir, theme)))
     return pages.template('registration.xml',
                           templateDir='%s/themes/%s/templates/' %
                           (baseDir, theme))
コード例 #3
0
ファイル: Index.py プロジェクト: calston/tums
class Page(rend.Page):
    db = None

    def __init__(self, db, *a, **kw):
        rend.Page.__init__(self, *a, **kw)
        self.db = db

    addSlash = True
    child_css = compression.CompressingResourceWrapper(
        static.File(Settings.BaseDir + '/css/'))
    child_scripts = compression.CompressingResourceWrapper(
        static.File(Settings.BaseDir + '/scripts/'))
    child_images = compression.CompressingResourceWrapper(
        static.File(Settings.BaseDir + '/images/'))
    child_sandbox = compression.CompressingResourceWrapper(
        static.File(Settings.BaseDir + '/sandbox/'))
    child_php = static.File('/var/www/localhost/htdocs/')
    child_packs = static.File(Settings.BaseDir + '/packages/')
    child_updates = static.File('/var/lib/samba/updates/')
    child_chart = chartResource()
    child_myvulani = Portal()
    child_files = compression.CompressingResourceWrapper(
        static.File(Settings.BaseDir + '/files/'))
    child_portal = PortalRedirector()
    child_topology = PageHelpers.Topology()

    def childFactory(self, ctx, seg):
        if seg == "favicon.ico":
            return static.File(Settings.BaseDir + '/images/favicon.ico')
        if seg == "whoami":
            return ThebeName(self.db[-1])
        if seg == 'snom':
            return Snom.Page(self.db)
        if seg == 'vRecordings':
            if os.path.exists('/var/lib/samba/data/vRecordings'):
                return static.File('/var/lib/samba/data/vRecordings/')
        return rend.Page.childFactory(self, ctx, seg)

    def render_content(self, ctx, data):
        return ctx.tag[tags.a(href="/auth/")["Login"]]

    def render_head(self, ctx, data):
        return ctx.tag[tags.xml(
            '<meta http-equiv="refresh" content="0;url=auth/"/>')]

    docFactory = loaders.stan(
        tags.html[tags.head[tags.title["Vulani"],
                            tags.invisible(render=tags.directive('head'))],
                  tags.body[tags.invisible(render=tags.directive('content'))]])
コード例 #4
0
ファイル: root.py プロジェクト: GMBarra/Docker
	def _processCache(self, ctx, service, rendC, segments):
		"""shortcuts if ctx's request can be cached with rendC.

		This function returns a cached item if a page is in the cache and
		request allows caching, None otherwise.  For cacheable requests,
		it instruments the request such that the page is actually cached.

		Cacheable pages also cause request's lastModified to be set.

		Requests with arguments or a user info are never cacheable.
		"""
		request = inevow.IRequest(ctx)
		if request.method!="GET" or request.args or request.getUser():
			return None

		if not rendC.isCacheable(segments, request):
			return None

		request.setLastModified(
			max(self.timestampStarted, service.rd.timestampUpdated))
		
		cache = base.caches.getPageCache(service.rd.sourceId)
		segments = tuple(segments)
		if segments in cache:
			return compression.CompressingResourceWrapper(cache[segments])

		caching.instrumentRequestForCaching(request,
			caching.enterIntoCacheAs(segments, cache))
		return None
コード例 #5
0
ファイル: Index.py プロジェクト: jpunwin/tums
    def document(self):
        baseDir = self.enamel.Settings.BaseDir
        theme = self.enamel.Settings.theme
        # Images, javascript and CSS locations
        # derived from base directory and theme 
        self.child_css = static.File('%s/themes/%s/css/' % (baseDir, theme))
        self.child_js  = compression.CompressingResourceWrapper(static.File(baseDir + '/js/'))
        self.child_images = compression.CompressingResourceWrapper(static.File('%s/themes/%s/images/' % (baseDir, theme)))

        return pages.stan(
                    tags.html[
                        tags.head[
                            tags.title["TUMS"],
                            tags.xml('<meta http-equiv="refresh" content="0;url=Dashboard/"/>')
                        ],
                        tags.body[ 
                            ""
                        ]
                    ]
                )
コード例 #6
0
 def childFactory(self, ctx, seg):
     if seg in self.modules:
         return compression.CompressingResourceWrapper(
             static.File(Settings.BaseDir + '/Waps/%s/static/' % seg))