Coverage for /Users/marco/Code/django-rosetta/rosetta/poutil : 50.55%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
except NameError: from sets import Set as set # Python 2.3 fallback
""" Return a timestamp with a timezone for the configured locale. If all else fails, consider localtime to be UTC. """ if not dt.tzinfo: tz = timezone.get_current_timezone() if not tz: tz = timezone.utc dt = dt.replace(tzinfo=timezone.get_current_timezone()) return dt.strftime("%Y-%m-%d %H:%M%z")
""" scans a couple possible repositories of gettext catalogs for the given language code
"""
# project/locale
# django/locale django_paths = [] for root, dirnames, filename in os.walk(os.path.abspath(os.path.dirname(django.__file__))): if 'locale' in dirnames: django_paths.append(os.path.join(root, 'locale')) continue cache.set('rosetta_django_paths', django_paths, 60 * 60) # settings if os.path.isdir(localepath): paths.append(localepath)
# project/app/locale else:
# django apps
# third party external
# local apps continue
_l, _c = map(lambda x: x.lower(), lang.split(u'-')) langs += (u'%s_%s' % (_l, _c), u'%s_%s' % (_l, _c.upper()), ) _l, _c = map(lambda x: x.lower(), lang.split(u'_')) langs += (u'%s-%s' % (_l, _c), u'%s-%s' % (_l, _c.upper()), )
r = []
r.append(first) if first + 1 < last: r.append(first + 1)
if current - 2 > first and current - 2 < last: r.append(current - 2) if current - 1 > first and current - 1 < last: r.append(current - 1) if current > first and current < last: r.append(current) if current + 1 < last and current + 1 > first: r.append(current + 1) if current + 2 < last and current + 2 > first: r.append(current + 2)
if last - 1 > first: r.append(last - 1) r.append(last)
r = list(set(r)) r.sort() prev = 10000 for e in r[:]: if prev + 1 < e: try: r.insert(r.index(e), '...') except ValueError: pass prev = e return r |