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

Commit

Permalink
Merge branch 'master' into payouts
Browse files Browse the repository at this point in the history
Conflicts:
	schema.sql
	www/assets/%version/gittip.js
  • Loading branch information
chadwhitacre committed Aug 20, 2012
2 parents fb01484 + d14cf6c commit 0105533
Show file tree
Hide file tree
Showing 42 changed files with 89,826 additions and 357 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
language: python
script: make test
before_script:
- createdb -U postgres gittip-test
- psql gittip-test -U postgres < schema.sql
- echo "DATABASE_URL=postgres://[email protected]/gittip-test" >> local.env

148 changes: 148 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
Gittip is in the public domain. Page two of this file is the summary of "CC0
1.0 Universal - Public Domain Dedication" from the Creative Commons. Page three
is the full legal code for the same.


http://creativecommons.org/publicdomain/zero/1.0/

No Copyright

The person who associated a work with this deed has dedicated the work to the
public domain by waiving all of his or her rights to the work worldwide under
copyright law, including all related and neighboring rights, to the extent
allowed by law.

You can copy, modify, distribute and perform the work, even for commercial
purposes, all without asking permission. See Other Information below.


Other Information

- In no way are the patent or trademark rights of any person affected by
CC0, nor are the rights that other persons may have in the work or in
how the work is used, such as publicity or privacy rights.

- Unless expressly stated otherwise, the person who associated a work
with this deed makes no warranties about the work, and disclaims
liability for all uses of the work, to the fullest extent permitted by
applicable law.

- When using or citing the work, you should not imply endorsement by the
author or the affirmer.


http://creativecommons.org/publicdomain/zero/1.0/legalcode


Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
("Commons") that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.

For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited to,
the following:

i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;

ii. moral rights retained by the original author(s) and/or performer(s);

iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;

iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;

v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;

vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and

vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free, non
transferable, non sublicensable, non exclusive, irrevocable and unconditional
license to exercise Affirmer's Copyright and Related Rights in the Work (i) in
all territories worldwide, (ii) for the maximum duration provided by applicable
law or treaty (including future time extensions), (iii) in any current or
future medium and for any number of copies, and (iv) for any purpose
whatsoever, including without limitation commercial, advertising or promotional
purposes (the "License"). The License shall be deemed effective as of the date
CC0 was applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder of the
License, and in such case Affirmer hereby affirms that he or she will not (i)
exercise any of his or her remaining Copyright and Related Rights in the Work
or (ii) assert any associated claims and causes of action with respect to the
Work, in either case contrary to Affirmer's express Statement of Purpose.

4. Limitations and Disclaimers.

a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.

b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied, statutory
or otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.

c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.

d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ building the software. All Python dependencies are included in vendor/. To
CANONICAL_HOST=
CANONICAL_SCHEME=http
DATABASE_URL=postgres://gittip@localhost/gittip
STRIPE_SECRET_API_KEY=1
STRIPE_PUBLISHABLE_API_KEY=1
BALANCED_API_SECRET=90bb3648ca0a11e1a977026ba7e239a9
GITHUB_CLIENT_ID=3785a9ac30df99feeef5
GITHUB_CLIENT_SECRET=e69825fafa163a0b0b6d2424c107a49333d46985
Expand Down Expand Up @@ -93,7 +95,7 @@ already been run. New DDL will be (manually) run against the production
database as part of deployment.


Testing
Testing [![Testing](https://secure.travis-ci.org/whit537/www.gittip.com.png)](http://travis-ci.org/whit537/www.gittip.com)
-------

Please write unit tests for all new code and all code you change. Gittip's test
Expand Down Expand Up @@ -126,3 +128,4 @@ See Also
- http://www1.networkforgood.org/
- http://anyfu.com/
- http://videovivoapp.com/
- http://techcrunch.com/2009/08/20/tipjoy-heads-to-the-deadpool/
35 changes: 18 additions & 17 deletions gittip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ def age():
return "%s month%s" % (nmonths, plural)


db = None # This global is wired in wireup. It's an instance of
db = None # This global is wired in wireup. It's an instance of
# gittip.postgres.PostgresManager.

# Not sure we won't want this for something yet. Prune if you don't find it in
# Not sure we won't want this for something yet. Prune if you don't find it in
# the codebase in a month.
OLD_AMOUNTS= [Decimal(a) for a in ('0.00', '0.08', '0.16', '0.32', '0.64', '1.28')]
OLD_OLD_AMOUNTS= [Decimal(a) for a in ('0.00', '0.08', '0.16', '0.32', '0.64', '1.28')]
OLD_AMOUNTS= [Decimal(a) for a in ('0.25',)]

AMOUNTS= [Decimal(a) for a in ('0.00', '0.25', '3.00', '6.00', '12.00', '24.00')]
AMOUNTS= [Decimal(a) for a in ('0.00', '1.00', '3.00', '6.00', '12.00', '24.00')]


__version__ = "~~VERSION~~"
Expand All @@ -40,11 +41,11 @@ def get_tip(tipper, tippee):
"""Given two user ids, return a Decimal.
"""
TIP = """\
SELECT amount
FROM tips
WHERE tipper=%s
AND tippee=%s
SELECT amount
FROM tips
WHERE tipper=%s
AND tippee=%s
ORDER BY mtime DESC
LIMIT 1
Expand All @@ -58,7 +59,7 @@ def get_tip(tipper, tippee):


def get_backed_amount(participant_id):
"""Given a unicode, return a Decimal.
"""Given a unicode, return a Decimal.
"""

BACKED = """\
Expand Down Expand Up @@ -145,22 +146,22 @@ def get_tips_and_total(tipper, for_payday=False, db=None):
# Payday and we're re-running that function. We only want to select
# tips that existed before Payday started, but haven't been processed
# as part of this Payday yet.
#
#
# It's a bug if the paydays subselect returns > 1 rows.
#
# XXX If we crash during Payday and we rerun it after a timezone
#
# XXX If we crash during Payday and we rerun it after a timezone
# change, will we get burned? How?

ts_filter = """\
AND mtime < %s
AND ( SELECT id
AND ( SELECT id
FROM transfers
WHERE tipper=t.tipper
AND tippee=t.tippee
AND timestamp >= %s
) IS NULL
"""
args = (tipper, for_payday, for_payday)
else:
Expand All @@ -171,7 +172,7 @@ def get_tips_and_total(tipper, for_payday=False, db=None):
TIPS = """\
SELECT * FROM (
SELECT DISTINCT ON (tippee)
SELECT DISTINCT ON (tippee)
amount
, tippee
, t.ctime
Expand Down Expand Up @@ -225,7 +226,7 @@ def canonize(request):
scheme = request.headers.get('X-Forwarded-Proto', 'http') # per Heroku
host = request.headers['Host']
bad_scheme = scheme != canonical_scheme
bad_host = bool(canonical_host) and (host != canonical_host)
bad_host = bool(canonical_host) and (host != canonical_host)
# '' and False => ''
if bad_scheme or bad_host:
url = '%s://%s' % (canonical_scheme, canonical_host)
Expand Down
6 changes: 3 additions & 3 deletions gittip/authentication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import datetime
import datetime
import rfc822
import time
import uuid
Expand Down Expand Up @@ -118,7 +118,7 @@ def outbound(response):
return
else:
# expired cookie in the request, instruct browser to delete it
response.headers.cookie['session'] = ''
response.headers.cookie['session'] = ''
expires = 0
else: # user is authenticated
response.headers['Expires'] = BEGINNING_OF_EPOCH # don't cache
Expand All @@ -134,7 +134,7 @@ def outbound(response):
)

cookie = response.headers.cookie['session']
# I am not setting domain, because it is supposed to default to what we
# I am not setting domain, because it is supposed to default to what we
# want: the domain of the object requested.
#cookie['domain']
cookie['path'] = '/'
Expand Down
12 changes: 6 additions & 6 deletions gittip/billing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def associate(participant_id, balanced_account_uri, card_uri):
except balanced.exc.NoResultFound:
customer = balanced.Account(email_address=email_address).save()
CUSTOMER = """\
UPDATE participants
UPDATE participants
SET balanced_account_uri=%s
WHERE id=%s
"""
db.execute(CUSTOMER, (customer.uri, participant_id))
customer.meta['participant_id'] = participant_id
Expand All @@ -77,11 +77,11 @@ def associate(participant_id, balanced_account_uri, card_uri):
out = last_bill_result
else:
out = last_bill_result = ''

STANDING = """\
UPDATE participants
SET last_bill_result=%s
SET last_bill_result=%s
WHERE id=%s
"""
Expand Down Expand Up @@ -197,7 +197,7 @@ def store_ach_error(participant_id, msg):

# Card
# ====
# While we're migrating data we need to support loading data from both Stripe
# While we're migrating data we need to support loading data from both Stripe
# and Balanced.


Expand Down
Loading

0 comments on commit 0105533

Please sign in to comment.