~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/util.py

Don't suggest that we support .bzr/ access on remote branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
        return '%s at %s' % (username, domains[-2])
182
182
    return '%s at %s' % (username, domains[0])
183
183
 
 
184
def hide_emails(emails):
 
185
    """
 
186
    try to obscure any email address in a list of bazaar committers' names.
 
187
    """
 
188
    result = []
 
189
    for email in emails:
 
190
        result.append(hide_email(email))
 
191
    return result
184
192
 
185
193
# only do this if unicode turns out to be a problem
186
194
#_BADCHARS_RE = re.compile(ur'[\u007f-\uffff]')
242
250
        except UnicodeDecodeError:
243
251
            s = s.decode('iso-8859-15')
244
252
 
245
 
    s = s.expandtabs().replace(' ', NONBREAKING_SPACE)
 
253
    s = cgi.escape(s).expandtabs().replace(' ', NONBREAKING_SPACE)
246
254
 
247
255
    return HSC.clean(s).replace('\n', '<br/>')
248
256
 
441
449
    return new_decorator
442
450
 
443
451
 
444
 
# common threading-lock decorator
445
 
 
446
 
 
447
 
def with_lock(lockname, debug_name=None):
448
 
    if debug_name is None:
449
 
        debug_name = lockname
450
 
 
451
 
    @decorator
452
 
    def _decorator(unbound):
453
 
 
454
 
        def locked(self, *args, **kw):
455
 
            getattr(self, lockname).acquire()
456
 
            try:
457
 
                return unbound(self, *args, **kw)
458
 
            finally:
459
 
                getattr(self, lockname).release()
460
 
        return locked
461
 
    return _decorator
462
 
 
463
452
 
464
453
@decorator
465
454
def lsprof(f):