git.ithinksw.org
/
philo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated links to the "project website" and made the READMEs consistent with the docs.
[philo.git]
/
philo
/
contrib
/
sobol
/
utils.py
diff --git
a/philo/contrib/sobol/utils.py
b/philo/contrib/sobol/utils.py
index
50d2113
..
6fd5a49
100644
(file)
--- a/
philo/contrib/sobol/utils.py
+++ b/
philo/contrib/sobol/utils.py
@@
-12,20
+12,17
@@
HASH_REDIRECT_GET_KEY = 's'
def make_redirect_hash(search_arg, url):
def make_redirect_hash(search_arg, url):
+ """Hashes a redirect for a ``search_arg`` and ``url`` to avoid providing a simple URL spoofing service."""
return sha1(smart_str(search_arg + url + settings.SECRET_KEY)).hexdigest()[::2]
def check_redirect_hash(hash, search_arg, url):
return sha1(smart_str(search_arg + url + settings.SECRET_KEY)).hexdigest()[::2]
def check_redirect_hash(hash, search_arg, url):
+ """Checks whether a hash is valid for a given ``search_arg`` and ``url``."""
return hash == make_redirect_hash(search_arg, url)
def make_tracking_querydict(search_arg, url):
return hash == make_redirect_hash(search_arg, url)
def make_tracking_querydict(search_arg, url):
- """
- Returns a QueryDict instance containing the information necessary
- for tracking clicks of this url.
-
- NOTE: will this kind of initialization handle quoting correctly?
- """
+ """Returns a :class:`QueryDict` instance containing the information necessary for tracking :class:`.Click`\ s on the ``url``."""
return QueryDict("%s=%s&%s=%s&%s=%s" % (
SEARCH_ARG_GET_KEY, urlquote_plus(search_arg),
URL_REDIRECT_GET_KEY, urlquote(url),
return QueryDict("%s=%s&%s=%s&%s=%s" % (
SEARCH_ARG_GET_KEY, urlquote_plus(search_arg),
URL_REDIRECT_GET_KEY, urlquote(url),