Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Clarify a few comments and things
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jun 27, 2012
1 parent 6b85117 commit ecbce11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions gittip/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def upsert(network, user_id, username, user_info, claim=False):
primary key in the underlying table in our own db.
If claim is True, the return value is the participant_id. Otherwise it is a
tuple: (participant_id, claimed [boolean], balance).
tuple: (participant_id [unicode], is_claimed [boolean], balance [Decimal]).
"""
typecheck( network, str
Expand Down Expand Up @@ -112,7 +112,8 @@ def upsert(network, user_id, username, user_info, claim=False):
"""
for k, v in user_info.items():
# I believe hstore can take any type of value, but psycopg2 can't.
# Cast everything to unicode. I believe hstore can take any type of
# value, but psycopg2 can't.
# https://postgres.heroku.com/blog/past/2012/3/14/introducing_keyvalue_data_storage_in_heroku_postgres/
# http://initd.org/psycopg/docs/extras.html#hstore-data-type
user_info[k] = unicode(v)
Expand Down
1 change: 1 addition & 0 deletions sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ CREATE TABLE social_network_users
, network text NOT NULL
, user_id text NOT NULL
, user_info hstore
, opted_out boolean DEFAULT FALSE
, participant_id text DEFAULT NULL REFERENCES participants ON DELETE RESTRICT
, UNIQUE(network, user_id)
);
Expand Down
4 changes: 2 additions & 2 deletions www/github/%login/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
usertype = userinfo.get("type", "unknown type of account").lower()
if usertype == "user":
can_tip = True
participant_id, claimed_time, balance = github.upsert(userinfo)
if claimed_time:
participant_id, is_claimed, balance = github.upsert(userinfo)
if is_claimed:
request.redirect('/%s/' % participant_id)

if not user.ANON:
Expand Down

0 comments on commit ecbce11

Please sign in to comment.