~ubuntu-branches/ubuntu/lucid/loggerhead/lucid-security

« back to all changes in this revision

Viewing changes to loggerhead/controllers/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): James Westby, Roland Mas, Jelmer Vernooij, James Westby
  • Date: 2009-08-26 13:18:03 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090826131803-0ce1fhaetci8b0c5
Tags: 1.17-0ubuntu1
[ Roland Mas ]
* Use the YUI library provided by libjs-yui. (Closes: #511286)

[ Jelmer Vernooij ]
* Use my debian.org address in Uploaders field.
* Add ${misc:Depends} to please lintian.
* Suggest recent version of paste, which doesn't expose internal port
  numbers in links. (Closes: #507000)
* Bump standards version to 3.8.1.

[ James Westby ]
* New upstream release.
* Drop get-orig-source rule in favour of debian/watch.
* Add python-pkg-resources and python-paste to Build-Depends,
  python-pkg-resources to Depends and python-simplejson to
  Recommends due to dependency changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# along with this program; if not, write to the Free Software
18
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
19
 
20
 
import re
21
20
import time
22
21
 
23
22
from paste.request import path_info_pop, parse_querystring
34
33
        self.buf = []
35
34
        self.buflen = 0
36
35
        self.writefunc = writefunc
37
 
        self.bytes_saved = 0
38
36
        self.buf_limit = buf_limit
39
37
 
40
38
    def flush(self):
41
 
        chunk = ''.join(self.buf)
42
 
        chunk = re.sub(r'\s*\n\s*', '\n', chunk)
43
 
        chunk = re.sub(r'[ \t]+', ' ', chunk)
44
 
        self.bytes_saved += self.buflen - len(chunk)
45
 
        self.writefunc(chunk)
 
39
        self.writefunc(''.join(self.buf))
46
40
        self.buf = []
47
41
        self.buflen = 0
48
42
 
84
78
 
85
79
        path = None
86
80
        if len(args) > 1:
87
 
            path = '/'.join(args[1:])
 
81
            path = unicode('/'.join(args[1:]), 'utf-8')
88
82
        self.args = args
89
83
 
90
84
        vals = {
109
103
        template.expand_into(w, **vals)
110
104
        w.flush()
111
105
        self.log.info(
112
 
            'Rendering %s: %r secs, %s bytes, %s (%2.1f%%) bytes saved' % (
113
 
                self.__class__.__name__,
114
 
                time.time() - z,
115
 
                w.bytes,
116
 
                w.bytes_saved,
117
 
                100.0*w.bytes_saved/w.bytes))
 
106
            'Rendering %s: %r secs, %s bytes' % (
 
107
                self.__class__.__name__, time.time() - z, w.bytes))
118
108
        return []
119
109
 
120
110
    def get_revid(self):
121
111
        h = self._history
122
112
        if h is None:
123
113
            return None
124
 
        if len(self.args) > 0:
 
114
        if len(self.args) > 0 and self.args != ['']:
125
115
            return h.fix_revid(self.args[0])
126
116
        else:
127
117
            return h.last_revid