Mercurial > public > sg101
comparison gpp/core/functions.py @ 241:27bee3ac85e6
For #93: fix url scheme for downloads.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 15 Sep 2010 01:01:40 +0000 |
parents | 423c39ee44e0 |
children | e3958aacd8dd |
comparison
equal
deleted
inserted
replaced
240:1246a4f1ab4f | 241:27bee3ac85e6 |
---|---|
78 if ip: | 78 if ip: |
79 match = IP_PAT.match(ip) | 79 match = IP_PAT.match(ip) |
80 ip = match.group(1) if match else None | 80 ip = match.group(1) if match else None |
81 | 81 |
82 return ip | 82 return ip |
83 | |
84 | |
85 def get_page(qdict): | |
86 """Attempts to retrieve the value for "page" from the given query dict and | |
87 return it as an integer. If the key cannot be found or converted to an | |
88 integer, 1 is returned. | |
89 """ | |
90 n = qdict.get('page', 1) | |
91 try: | |
92 n = int(n) | |
93 except ValueError: | |
94 n = 1 | |
95 return n |