~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject.py

  • Committer: William Grant
  • Date: 2010-02-25 05:47:27 UTC
  • Revision ID: grantw@unimelb.edu.au-20100225054727-fhxksrxj5vhrf5dm
Share one TemplateLoader between every instance of every view, so we cache EVERYTHING.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
from storm.locals import Desc, Store
32
32
import genshi
33
33
from genshi.filters import HTMLFormFiller
34
 
from genshi.template import Context, TemplateLoader
 
34
from genshi.template import Context
35
35
import formencode
36
36
import formencode.validators
37
37
 
695
695
 
696
696
        #Open the projectset Fragment, and render it for inclusion
697
697
        #into the ProjectSets page
698
 
        #XXX: This could be a lot cleaner
699
 
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
700
 
 
701
698
        set_fragment = os.path.join(os.path.dirname(__file__),
702
699
                "templates/projectset_fragment.html")
703
700
        project_fragment = os.path.join(os.path.dirname(__file__),
705
702
 
706
703
        for projectset in \
707
704
            self.context.project_sets.order_by(ivle.database.ProjectSet.id):
708
 
            settmpl = loader.load(set_fragment)
 
705
            settmpl = self._loader.load(set_fragment)
709
706
            setCtx = Context()
710
707
            setCtx['req'] = req
711
708
            setCtx['projectset'] = projectset
715
712
 
716
713
            for project in \
717
714
                projectset.projects.order_by(ivle.database.Project.deadline):
718
 
                projecttmpl = loader.load(project_fragment)
 
715
                projecttmpl = self._loader.load(project_fragment)
719
716
                projectCtx = Context()
720
717
                projectCtx['req'] = req
721
718
                projectCtx['project'] = project