Merge branch 'master' of github.com:Gluejar/regluit

Conflicts:
	core/management/commands/random_campaigns.py
pull/1/head
Andromeda Yelton 2011-10-13 12:46:52 -04:00
commit 145c275795
4 changed files with 238 additions and 64 deletions

View File

@ -1,5 +1,6 @@
import json
import logging
from xml.etree import ElementTree
import requests
from django.conf import settings
@ -55,6 +56,12 @@ def add_by_googlebooks_id(googlebooks_id):
return e
def thingisbn(isbn):
url = "http://www.librarything.com/api/thingISBN/%s" % isbn
xml = requests.get(url, headers={"User-Agent": settings.USER_AGENT}).content
doc = ElementTree.fromstring(xml)
return [e.text for e in doc.findall('isbn')]
def _get_json(url, params={}):
# TODO: should X-Forwarded-For change based on the request from client?
headers = {'User-Agent': settings.USER_AGENT,

View File

@ -1,6 +1,7 @@
from decimal import Decimal
from random import randint, randrange
from datetime import datetime, timedelta
from decimal import Decimal as D
from django.core.management.base import BaseCommand
@ -19,7 +20,7 @@ class Command(BaseCommand):
campaign.description = "Test Campaign"
# random campaign target between $200 and $10,000
campaign.target = Decimal(str(randint(200,10000)))
campaign.target = D(randint(200,10000))
# random deadline between 5 days from now and 180 days from now
now = datetime.now()

View File

@ -10,7 +10,7 @@ from regluit.core.models import Campaign, Work, UnglueitError
from regluit.core import bookloader, models, search
from regluit.payment.parameters import PAYMENT_TYPE_AUTHORIZATION
class TestBooks(TestCase):
class TestBookLoader(TestCase):
def test_add_book(self):
# edition
@ -46,6 +46,12 @@ class TestBooks(TestCase):
e = bookloader.add_by_isbn('0139391401')
self.assertEqual(e, None)
def test_thingisbn(self):
isbns = bookloader.thingisbn('0441012035')
self.assertTrue(len(isbns) > 20)
self.assertTrue('0441012035' in isbns)
self.assertTrue('3453313895' in isbns)
class SearchTests(TestCase):
def test_basic_search(self):
@ -136,11 +142,3 @@ class CampaignTests(TestCase):
c5.save()
c5.activate().withdraw('testing')
self.assertEqual(c5.status, 'WITHDRAWN')
def suite():
testcases = [TestBooks, SearchTests, CampaignTests]
suites = unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(testcase) for testcase in testcases])
return suites

View File

@ -6,7 +6,7 @@
text-decoration: none;
font-weight: bold;
font-size: 13px;
letter-spacing: 1px;
letter-spacing: -0.05em;
text-transform: capitalize;
}
.panelborders {
@ -20,7 +20,7 @@ div.book-list {
vertical-align: middle;
height: 43px;
line-height: 43px;
margin: 0 5px 0px 0;
margin: 0 5px 0 0;
padding: 7px 0;
overflow: hidden;
}
@ -49,14 +49,13 @@ div.book-list div.book-name span {
height: 43px;
line-height: 43px;
}
div.book-list div.add-wishlist, div.book-list div.remove-wishlist {
div.book-list div.add-wishlist {
margin-right: 10px;
padding-right: 10px;
background: url("/static/images/booklist/booklist-vline.png") right center no-repeat;
cursor: pointer;
float: left;
}
div.book-list div.add-wishlist span, div.book-list div.remove-wishlist span {
div.book-list div.add-wishlist a {
font-weight: normal;
color: #3d4e53;
text-transform: none;
@ -90,6 +89,7 @@ div.unglue-this.complete .unglue-this-inner2 {
}
div.unglue-this.complete a {
color: #fff;
display: block;
}
div.unglue-this.processing .unglue-this-inner1 {
background: url("/static/images/booklist/bg.png") 0 0 no-repeat;
@ -162,7 +162,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
}
.book_panel {
margin: 20px auto;
padding: 0px 5px 5px 5px;
padding: 0 5px 5px 5px;
height: 300px;
width: 120px;
line-height: 16px;
@ -183,8 +183,8 @@ ul.navigation li a:hover, ul.navigation li.active a {
margin: 0;
}
.book_panel img {
padding: 5px 0px;
margin: 0px;
padding: 5px 0;
margin: 0;
}
.book_panel:hover {
color: #3d4e53;
@ -194,7 +194,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
text-align: left;
}
.book_panel_back {
margin: 0px auto;
margin: 0 auto;
padding: 10px;
height: 295px;
width: 120px;
@ -208,9 +208,9 @@ ul.navigation li a:hover, ul.navigation li.active a {
font-weight: normal;
}
.unglued_white {
margin: 0px auto;
margin: 0 auto;
margin-bottom: 5px;
padding: 10px 0px;
padding: 10px 0;
}
.status {
color: #8dc63f;
@ -219,12 +219,12 @@ ul.navigation li a:hover, ul.navigation li.active a {
.read_itbutton {
width: 118px;
height: 35px;
padding: 0px 0px;
padding: 0 0;
background: #FFFFFF;
margin: 0px;
border-radius: 4px 4px 4px 4px;
margin: 0;
-moz-border-radius: 4px 4px 4px 4px;
-webkit-border-radius: 4px 4px 4px 4px;
border-radius: 4px 4px 4px 4px;
border: 1px solid #81bb38;
}
.read_itbutton a {
@ -232,7 +232,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
font-size: 11px;
background: url("/static/images/book-panel/book_icon.png") no-repeat left center;
background-position: 10px center;
padding: 0px 0px 0px 30px;
padding: 0 0 0 30px;
color: #73a334;
text-decoration: none;
font-weight: bold;
@ -244,7 +244,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
#add_towish {
width: 130px;
height: 30px;
padding: 0px 0px;
padding: 0 0;
margin: 10px auto;
}
#add_towish a {
@ -267,8 +267,8 @@ ul.navigation li a:hover, ul.navigation li.active a {
#white_text {
width: 130px;
height: 40px;
padding: 17px 0px;
margin: 0px;
padding: 17px 0;
margin: 0;
}
#white_text a {
color: #FFFFFF;
@ -281,7 +281,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
#moreinfo {
width: 130px;
height: 30px;
padding: 0px;
padding: 0;
margin: 15px 0 0;
}
#moreinfo a {
@ -312,7 +312,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
}
.read {
margin: 15px auto;
padding: 0px;
padding: 0;
width: 140px;
color: #8dc63f;
height: 40px;
@ -320,7 +320,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
float: left;
}
.read p {
margin: 0px;
margin: 0;
padding: 10px 3px;
width: 50px;
font-size: 10pt;
@ -328,12 +328,12 @@ ul.navigation li a:hover, ul.navigation li.active a {
}
.read img {
padding: 5px;
margin: 0px;
margin: 0;
float: left;
}
.right_add {
padding: 10px;
margin: 0px;
margin: 0;
float: right;
}
p.right_add {
@ -345,9 +345,9 @@ p.right_add {
.book_panel_interior {
float: left;
position: relative;
margin: 0px;
padding: 0px;
left: 0px;
margin: 0;
padding: 0;
left: 0;
}
.book_panel_interior img {
z-index: 100;
@ -390,7 +390,7 @@ h3 .jsmod-title {
height: 73px;
}
h3.jsmod-title span {
background: url(../images/icon-h3.png) 90% center no-repeat;
background: url("/static/images/icon-h3.png") 90% center no-repeat;
font-size: 17px;
color: #fff;
padding: 26px 40px 27px 20px;
@ -400,7 +400,6 @@ ul.menu {
list-style: none;
padding: 0;
margin: 0;
line-height: 20px;
}
a.readon {
background: url("/static/images/bg.png") 100% -72px no-repeat;
@ -436,7 +435,7 @@ a {
}
.js-logo {
float: left;
padding-top: 20px;
padding-top: 10px;
}
.js-logo a img {
border: none;
@ -450,25 +449,25 @@ a {
padding: 0 10px;
}
.js-topmenu ul li a {
color: #fff;
color: #3d4e53;
height: 36px;
line-height: 36px;
display: block;
text-decoration: none;
font-weight: bold;
font-size: 13px;
letter-spacing: 1px;
letter-spacing: -0.05em;
text-transform: capitalize;
}
.js-topmenu ul li span#welcome {
color: yellow;
color: #8dc63f;
height: 36px;
line-height: 36px;
display: block;
text-decoration: none;
font-weight: bold;
font-size: 13px;
letter-spacing: 1px;
letter-spacing: -0.05em;
text-transform: capitalize;
}
.js-topmenu ul lilast a {
@ -486,23 +485,27 @@ a {
}
.js-topnews {
float: left;
width: 60%;
width: 100%;
}
.js-news-text {
float: left;
width: 70%;
font-size: 16px;
color: #3d4e53;
.js-topnews1 {
background: url("/static/images/header/header-m.png") 0 0 repeat-y;
}
.js-news-links {
float: right;
width: 30%;
.js-topnews2 {
background: url("/static/images/header/header-t.png") 0 0 no-repeat;
}
.js-topnews3 {
background: url("/static/images/header/header-b.png") 0 100% no-repeat;
display: block;
overflow: hidden;
padding: 10px;
}
.js-search {
width: 960px;
margin: 0 auto;
clear: both;
padding: 0;
float: right;
width: 30%;
padding-top: 25px;
}
.js-search input {
float: left;
}
.js-search .inputbox {
padding: 0 0 0 15px;
@ -527,7 +530,7 @@ a {
cursor: pointer;
}
.js-search-inner {
margin: 0 auto;
float: right;
}
#js-leftcol {
float: left;
@ -542,9 +545,9 @@ a {
#js-leftcol .jsmod-content {
border: 1px solid #edf3f4;
margin-left: 10px;
border-radius: 0 0 10px 10px;
-moz-border-radius: 0 0 10px 10px;
-webkit-border-radius: 0 0 10px 10px;
border-radius: 0 0 10px 10px;
}
#js-leftcol ul.level1 > li > a {
text-transform: uppercase;
@ -560,10 +563,9 @@ a {
}
#js-leftcol ul.level2 li a {
color: #6994a3;
line-height: 20px;
}
#js-maincol-fr {
float: left;
float: right;
width: 725px;
}
div.content-block {
@ -611,3 +613,169 @@ div.content-block-content .cols3 .column {
margin-right: auto;
padding: 5px 15px;
}
.block-inner {
padding-right: 10px;
}
.user-block {
width: 100%;
clear: both;
}
.user-block-hide {
float: left;
width: 100%;
clear: both;
}
.user-block-hide .block {
float: left;
width: 25%;
}
.user-block-hide input {
float: left;
margin: 3px 10px 0 0;
}
.user-block-hide label {
float: left;
width: 90%;
}
.user-block1 {
float: left;
width: 25%;
}
.user-block2 {
color: #6994a3;
font-size: 11px;
line-height: normal;
float: left;
width: 25%;
}
.user-block3, .user-block4 {
float: right;
width: 25%;
margin-top: 10px;
}
img.user-avatar {
float: left;
margin-right: 10px;
}
.social {
width: 100%;
padding-left: 35px;
}
span.user-name, span.user-date, span.user-short-info {
display: block;
}
span.user-name, span.user-name a, a {
font-size: 12px;
color: #3d4e53;
}
span.user-status-title {
float: left;
margin-right: 8px;
padding-top: 5px;
}
span.rounded {
border: 1px solid #d4d4d4;
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
padding: 1px;
color: #fff;
margin: 0 8px 0 0;
display: inline-block;
}
span.rounded > span {
padding: 7px 10px;
min-width: 15px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
text-align: center;
display: inline-block;
}
span.blue {
background: #a7d26a url("/static/images/header-button-blue.png") left bottom repeat-x;
}
span.orange {
background: #eabc7c url("/static/images/header-button-orange.png") left bottom repeat-x;
}
span.grey {
background: #bacfd6 url("/static/images/header-button-grey.png") left bottom repeat-x;
}
div.check-list {
float: left;
width: 100%;
padding-bottom: 7px;
}
a.profile-edit {
display: block;
background: url("/static/images/header/icon-edit.png") right top no-repeat;
}
div.profile-save {
padding-top: 15px;
}
a.profile-save {
background: url("/static/images/header/save-setting.png") 0 0 no-repeat;
width: 116px;
height: 42px;
display: block;
text-indent: -100000px;
}
a.my-setting {
background: #d6dde0 url("/static/images/header/explane.png") 90% center no-repeat;
border-radius: 7px;
height: 50px;
line-height: 50px;
display: block;
padding: 0 0 0 10px;
font-size: 20px;
}
a.my-setting.active {
background: #d6dde0 url("/static/images/header/collspane.png") 90% center no-repeat;
}
#tabs {
border-bottom: 4px solid #8DC63F;
clear: both;
float: left;
margin-left: 10px;
margin-top: 10px;
width: 100%;
}
#tabs ul.book-list-view {
margin-bottom: 4px !important;
}
#tabs-1, #tabs-2, #tabs-3 {
margin-left: 10px;
}
ul.tabs {
float: left;
padding: 0;
margin: 0;
list-style: none;
}
ul.tabs li {
float: left;
height: 46px;
line-height: 46px;
margin-right: 10px;
}
ul.tabs li a {
height: 46px;
line-height: 46px;
display: block;
text-align: center;
padding: 0 10px;
min-width: 80px;
border-radius: 7px 7px 0 0;
background: url("/static/images/header/bg-tabs1.png") left bottom repeat-x;
}
ul.tabs li a:hover, ul.tabs li.active a {
background: url("/static/images/header/bg-tabs.png") left bottom repeat-x;
color: #fff;
}
.book-list span.rounded > span {
line-height: normal;
width: 75px;
}
.book-list span.rounded > span a {
text-transform: capitalize;
}