Skip to content

Commit 6535505

Browse files
committed
Revert "Merge branch 'master' into master"
This reverts commit bd52df0, reversing changes made to e455d9a.
1 parent bd52df0 commit 6535505

405 files changed

Lines changed: 1957 additions & 85250 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ settings/keys/*
66
*.dot
77
reports
88
ENV
9-
venv
109
.DS_Store
1110
build
1211
deploy/last-update
1312
logs/*
14-
cache/*
1513
celerybeat.pid
1614
celerybeat-schedule
1715
.gitignore~
18-
static/scss/**/*.css.map
19-
*.retry
16+
static/scss/*.css.map

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ services:
1010
env:
1111
global:
1212
- DJANGO_SETTINGS_MODULE=regluit.settings.travis
13-
- PYTHONPATH=/home/travis/build/EbookFoundation/
13+
- PYTHONPATH=/home/travis/build/Gluejar/
1414

1515
before_install:
1616
- sudo mkdir /var/log/django
1717
- sudo chmod 777 /var/log/django
18-
- mkdir ~/build/EbookFoundation/regluit/settings/keys/
19-
- cp ~/build/EbookFoundation/regluit/settings/dummy/__init__.py ~/build/EbookFoundation/regluit/settings/keys/__init__.py
20-
- openssl aes-256-cbc -K $encrypted_56eb2b7cc527_key -iv $encrypted_56eb2b7cc527_iv -in ~/build/EbookFoundation/regluit/test/travis-host.py.enc -out ~/build/EbookFoundation/regluit/settings/keys/host.py -d
18+
- mkdir ~/build/Gluejar/regluit/settings/keys/
19+
- cp ~/build/Gluejar/regluit/settings/dummy/__init__.py ~/build/Gluejar/regluit/settings/keys/__init__.py
20+
- openssl aes-256-cbc -K $encrypted_56eb2b7cc527_key -iv $encrypted_56eb2b7cc527_iv -in ~/build/Gluejar/regluit/test/travis-host.py.enc -out ~/build/Gluejar/regluit/settings/keys/host.py -d
2121

2222
install:
2323
- pip install -r requirements_versioned.pip

README.md

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,7 @@ The partitioning between these modules is not as clean as would be ideal. `payme
1212

1313
regluit was originally developed on Django 1.3 (python 2.7) and currently runs on Django 1.8.
1414

15-
Development (Vagrant + Virtualbox)
16-
-------
17-
18-
The recommended method for local development is to create a virtual machine with [Vagrant](https://www.vagrantup.com/) and [Virtualbox](https://www.virtualbox.org/wiki/Downloads).
19-
With this method, the only requirements on the host machine are `virtualbox` and `vagrant`.
20-
Vagrant will use the `ansible-local` provisioner, therefore installing python and ansible on the host machine is not necessary.
21-
22-
__Instructions for Ubuntu 16:__
23-
1. Install virtualbox: `sudo apt-get install virtualbox`
24-
2. Install vagrant: `sudo apt-get install vagrant`
25-
3. Clone the `EbookFoundation/regluit` repository.
26-
4. Navigate to the base directory of the cloned repo (where `Vagrantfile` is located).
27-
5. Run `vagrant up` to create the VM, install dependencies, and start necessary services.
28-
* Note: This step may take up to 15 minutes to complete.
29-
6. Once the VM has been created, run `vagrant ssh` to log in to the virtual machine you just created. If provisioning was successful, you should see a success message upon login.
30-
* If virtualenv doesn't activate upon login, you can do it manually by running `cd /opt/regluit && source venv/bin/activate`
31-
7. Within the VM, run `./manage.py runserver 0.0.0.0:8000` to start the Django development server.
32-
8. On your host machine, open your web browser of choice and navigate to `http://127.0.0.1:8000`
33-
34-
__Instructions for other platforms (Windows/OSX):__
35-
* Steps are essentially the same, except for the installation of Vagrant and Virtualbox. Refer to each package's documentation for specific installation instructions.
36-
37-
_NOTE:_ If running Windows on your host machine, ensure you are running `vagrant up` from an elevated command prompt, e.g. right click on Command Prompt -> Run As Administrator.
38-
39-
40-
Development (Host Machine)
15+
Develop
4116
-------
4217

4318
Here are some instructions for setting up regluit for development on

Vagrantfile

Lines changed: 0 additions & 56 deletions
This file was deleted.

core/mobi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ def convert_to_mobi(input_url, input_format="application/epub+zip"):
1313
return a string with the output of mobigen computation
1414
1515
"""
16-
if mobigen_url and mobigen_user_id and mobigen_password:
17-
print 'settings ok'
16+
1817
# using verify=False since at the moment, using a self-signed SSL cert.
1918

2019
payload = requests.get(input_url).content
@@ -27,6 +26,5 @@ def convert_to_mobi(input_url, input_format="application/epub+zip"):
2726
if r.status_code == 200:
2827
return r.content
2928
else:
30-
print "{0}: {1}".format(r.status_code, r.content)
3129
raise Exception("{0}: {1}".format(r.status_code, r.content))
3230

core/models/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747
TRANSACTION_STATUS_FAILED,
4848
TRANSACTION_STATUS_INCOMPLETE
4949
)
50-
51-
from regluit.utils import encryption as crypto
50+
from regluit.utils import crypto
5251
from regluit.utils.localdatetime import date_today
5352

5453
from regluit.core.parameters import (

core/models/bibmodels.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ def get_or_add(type='goog', value=None, edition=None, work=None):
108108

109109
def __unicode__(self):
110110
return u'{0}:{1}'.format(self.type, self.value)
111-
111+
112112
def label(self):
113113
return ID_CHOICES_MAP.get(self.type, self.type)
114-
114+
115115
def url(self):
116116
return id_url(self.type, self.value)
117117

@@ -129,7 +129,7 @@ class Work(models.Model):
129129
is_free = models.BooleanField(default=False)
130130
landings = GenericRelation(Landing, related_query_name='works')
131131
related = models.ManyToManyField('self', symmetrical=False, blank=True, through='WorkRelation', related_name='reverse_related')
132-
age_level = models.CharField(max_length=5, choices=AGE_LEVEL_CHOICES, default='', blank=True)
132+
age_level = models.CharField(max_length=5, choices=AGE_LEVEL_CHOICES, default='', blank=True)
133133

134134
class Meta:
135135
ordering = ['title']
@@ -165,7 +165,7 @@ def delete(self, cascade=True, *args, **kwargs):
165165
for work_relation in self.works_related_from.all():
166166
work_relation.delete()
167167
super(Work, self).delete(*args, **kwargs) # Call the "real" save() method.
168-
168+
169169
def id_for(self, type):
170170
return id_for(self, type)
171171

@@ -233,7 +233,7 @@ def openlibrary_id(self):
233233
@property
234234
def openlibrary_url(self):
235235
return id_url('olwk', self.openlibrary_id)
236-
236+
237237
def cover_filetype(self):
238238
if self.uses_google_cover():
239239
return 'jpeg'
@@ -431,14 +431,14 @@ def mobifiles(self):
431431

432432
def pdffiles(self):
433433
return EbookFile.objects.filter(edition__work=self, format='pdf').exclude(file='').order_by('-created')
434-
434+
435435
def versions(self):
436436
version_labels = []
437437
for ebook in self.ebooks_all():
438438
if ebook.version_label and not ebook.version_label in version_labels:
439439
version_labels.append(ebook.version_label)
440440
return version_labels
441-
441+
442442
def formats(self):
443443
fmts = []
444444
for fmt in ['pdf', 'epub', 'mobi', 'html']:
@@ -450,7 +450,7 @@ def formats(self):
450450
def remove_old_ebooks(self):
451451
# this method is triggered after an file upload or new ebook saved
452452
old = Ebook.objects.filter(edition__work=self, active=True).order_by('-version_iter', '-created')
453-
453+
454454
# keep highest version ebook for each format and version label
455455
done_format_versions = []
456456
for eb in old:
@@ -459,7 +459,7 @@ def remove_old_ebooks(self):
459459
eb.deactivate()
460460
else:
461461
done_format_versions.append(format_version)
462-
462+
463463
# check for failed uploads.
464464
null_files = EbookFile.objects.filter(edition__work=self, file='')
465465
for ebf in null_files:
@@ -796,12 +796,12 @@ class Subject(models.Model):
796796

797797
class Meta:
798798
ordering = ['name']
799-
799+
800800
@classmethod
801801
def set_by_name(cls, subject, work=None, authority=None):
802802
''' use this method whenever you would be creating a new subject!'''
803803
subject = subject.strip()
804-
804+
805805
# make sure it's not a ; delineated list
806806
subjects = subject.split(';')
807807
for additional_subject in subjects[1:]:
@@ -826,12 +826,12 @@ def set_by_name(cls, subject, work=None, authority=None):
826826
if not subject_obj.authority and authority:
827827
subject_obj.authority = authority
828828
subject_obj.save()
829-
829+
830830
subject_obj.works.add(work)
831-
return subject_obj
831+
return subject_obj
832832
else:
833833
return None
834-
834+
835835
def __unicode__(self):
836836
return self.name
837837

@@ -1123,6 +1123,7 @@ def make_mobi(self):
11231123
asking=self.asking,
11241124
source=self.file.url
11251125
)
1126+
11261127
new_mobi_ebf.file.save(path_for_file(new_mobi_ebf, None), mobi_cf)
11271128
new_mobi_ebf.save()
11281129
if self.ebook:
@@ -1222,7 +1223,7 @@ def version(self):
12221223
return '.{}'.format(self.version_iter)
12231224
else:
12241225
return '().{}'.format(self.version_label, self.version_iter)
1225-
1226+
12261227
def set_version(self, version):
12271228
#set both version_label and version_iter with one string with format "version.iter"
12281229
version_pattern = r'(.*)\.(\d+)$'
@@ -1232,11 +1233,11 @@ def set_version(self, version):
12321233
else:
12331234
self.version_label = version
12341235
self.save()
1235-
1236+
12361237
def set_next_iter(self):
12371238
# set the version iter to the next unused iter for that version
12381239
for ebook in Ebook.objects.filter(
1239-
edition=self.edition,
1240+
edition=self.edition,
12401241
version_label=self.version_label,
12411242
format=self.format,
12421243
provider=self.provider
@@ -1245,7 +1246,7 @@ def set_next_iter(self):
12451246
break
12461247
self.version_iter = iter + 1
12471248
self.save()
1248-
1249+
12491250
@property
12501251
def rights_badge(self):
12511252
if self.rights is None:

core/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,8 @@ def test_download_page(self):
998998

999999
anon_client = Client()
10001000
response = anon_client.get("/work/%s/download/" % w.id, follow=True)
1001-
self.assertContains(response, "/download_ebook/%s/"% eb1.id, count=11)
1002-
self.assertContains(response, "/download_ebook/%s/"% eb2.id, count=4)
1001+
self.assertContains(response, "/download_ebook/%s/"% eb1.id, count=11)
1002+
self.assertContains(response, "/download_ebook/%s/"% eb2.id, count=5)
10031003
self.assertTrue(eb1.edition.work.is_free)
10041004
eb1.delete()
10051005
self.assertTrue(eb2.edition.work.is_free)

frontend/forms/__init__.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@ class Meta:
281281

282282

283283
class CampaignPurchaseForm(forms.Form):
284-
anonymous = forms.BooleanField(required=False,
285-
label_suffix='',
286-
label=_("Make this purchase anonymous"))
284+
anonymous = forms.BooleanField(required=False, label=_("Make this purchase anonymous, please"))
287285
offer_id = forms.IntegerField(required=False)
288286
offer = None
289287
library_id = forms.IntegerField(required=False)
@@ -348,8 +346,7 @@ def trans_extra(self):
348346
class CampaignThanksForm(forms.Form):
349347
anonymous = forms.BooleanField(
350348
required=False,
351-
label_suffix='',
352-
label=_("Make this contribution anonymous")
349+
label=_("Make this contribution anonymous, please")
353350
)
354351
preapproval_amount = forms.DecimalField(
355352
required = True,
@@ -383,10 +380,7 @@ class CampaignPledgeForm(forms.Form):
383380
def amount(self):
384381
return self.cleaned_data["preapproval_amount"] if self.cleaned_data else None
385382

386-
anonymous = forms.BooleanField(
387-
required=False,
388-
label_suffix='',
389-
label=_("Make this support anonymous"))
383+
anonymous = forms.BooleanField(required=False, label=_("Make this support anonymous, please"))
390384
ack_name = forms.CharField(
391385
required=False,
392386
max_length=64,

0 commit comments

Comments
 (0)