~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/zptsupport.py

  • Committer: Michael Hudson
  • Date: 2009-02-25 04:41:51 UTC
  • mto: This revision was merged to the branch mainline in revision 294.
  • Revision ID: michael.hudson@canonical.com-20090225044151-o6dffxt1jmoz8zo2
remove useless genericity in how we show changed files in a revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import logging
19
19
import os
20
20
import pkg_resources
21
 
import re
22
21
import StringIO
23
22
 
24
23
from simpletal import simpleTAL, simpleTALES
25
24
 
 
25
logging.getLogger("simpleTAL").setLevel(logging.INFO)
 
26
logging.getLogger("simpleTALES").setLevel(logging.INFO)
 
27
 
 
28
 
26
29
_zpt_cache = {}
27
30
 
28
31
 
30
33
    tinstance = _zpt_cache.get(tfile)
31
34
    stat = os.stat(tfile)
32
35
    if tinstance is None or tinstance.stat != stat:
33
 
        text = open(tfile).read()
34
 
        text = re.sub(r'\s*\n\s*', '\n', text)
35
 
        text = re.sub(r'[ \t]+', ' ', text)
36
36
        tinstance = _zpt_cache[tfile] = TemplateWrapper(
37
 
            simpleTAL.compileXMLTemplate(text), tfile, stat)
 
37
            simpleTAL.compileXMLTemplate(open(tfile)), tfile, stat)
38
38
    return tinstance
39
39
 
40
40