Login

Snippets by jcassee

Snippet List

Localized digits

Arabic and Farsi languages use their own digits. This template filter translates any digits in the supplied unicode string into the correct ones for the language. The previous version used StringIO to parse the string one character at a time. It now uses regular expressions. I just saw that kcarnold created two snippets that also removed the need for StringIO: [981](http://www.djangosnippets.org/snippets/981/) and [982](http://www.djangosnippets.org/snippets/982/). That last snippet is almost the same as this one.

  • i18n
Read More

RefreshSessionMiddleware

This middleware refreshes the session before it expires to avoid dropping the session of an active (but read-only) user. By default it refreshes the session after half the expiry time has elapsed. (This middleware does nothing for browser-length sessions.)

  • sessions
  • refresh
Read More

jcassee has posted 2 snippets.