Skip to content

Commit

Permalink
Revert "Merge branch 'master' into master"
Browse files Browse the repository at this point in the history
This reverts commit bd52df0, reversing
changes made to e455d9a.
  • Loading branch information
eshellman committed Nov 3, 2018
1 parent bd52df0 commit 6535505
Show file tree
Hide file tree
Showing 405 changed files with 1,957 additions and 85,250 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ settings/keys/*
*.dot
reports
ENV
venv
.DS_Store
build
deploy/last-update
logs/*
cache/*
celerybeat.pid
celerybeat-schedule
.gitignore~
static/scss/**/*.css.map
*.retry
static/scss/*.css.map
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ services:
env:
global:
- DJANGO_SETTINGS_MODULE=regluit.settings.travis
- PYTHONPATH=/home/travis/build/EbookFoundation/
- PYTHONPATH=/home/travis/build/Gluejar/

before_install:
- sudo mkdir /var/log/django
- sudo chmod 777 /var/log/django
- mkdir ~/build/EbookFoundation/regluit/settings/keys/
- cp ~/build/EbookFoundation/regluit/settings/dummy/__init__.py ~/build/EbookFoundation/regluit/settings/keys/__init__.py
- 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
- mkdir ~/build/Gluejar/regluit/settings/keys/
- cp ~/build/Gluejar/regluit/settings/dummy/__init__.py ~/build/Gluejar/regluit/settings/keys/__init__.py
- 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

install:
- pip install -r requirements_versioned.pip
Expand Down
27 changes: 1 addition & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,7 @@ The partitioning between these modules is not as clean as would be ideal. `payme

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

Development (Vagrant + Virtualbox)
-------

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).
With this method, the only requirements on the host machine are `virtualbox` and `vagrant`.
Vagrant will use the `ansible-local` provisioner, therefore installing python and ansible on the host machine is not necessary.

__Instructions for Ubuntu 16:__
1. Install virtualbox: `sudo apt-get install virtualbox`
2. Install vagrant: `sudo apt-get install vagrant`
3. Clone the `EbookFoundation/regluit` repository.
4. Navigate to the base directory of the cloned repo (where `Vagrantfile` is located).
5. Run `vagrant up` to create the VM, install dependencies, and start necessary services.
* Note: This step may take up to 15 minutes to complete.
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.
* If virtualenv doesn't activate upon login, you can do it manually by running `cd /opt/regluit && source venv/bin/activate`
7. Within the VM, run `./manage.py runserver 0.0.0.0:8000` to start the Django development server.
8. On your host machine, open your web browser of choice and navigate to `http://127.0.0.1:8000`

__Instructions for other platforms (Windows/OSX):__
* Steps are essentially the same, except for the installation of Vagrant and Virtualbox. Refer to each package's documentation for specific installation instructions.

_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.


Development (Host Machine)
Develop
-------

Here are some instructions for setting up regluit for development on
Expand Down
56 changes: 0 additions & 56 deletions Vagrantfile

This file was deleted.

4 changes: 1 addition & 3 deletions core/mobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ def convert_to_mobi(input_url, input_format="application/epub+zip"):
return a string with the output of mobigen computation
"""
if mobigen_url and mobigen_user_id and mobigen_password:
print 'settings ok'

# using verify=False since at the moment, using a self-signed SSL cert.

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

3 changes: 1 addition & 2 deletions core/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
TRANSACTION_STATUS_FAILED,
TRANSACTION_STATUS_INCOMPLETE
)

from regluit.utils import encryption as crypto
from regluit.utils import crypto
from regluit.utils.localdatetime import date_today

from regluit.core.parameters import (
Expand Down
37 changes: 19 additions & 18 deletions core/models/bibmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def get_or_add(type='goog', value=None, edition=None, work=None):

def __unicode__(self):
return u'{0}:{1}'.format(self.type, self.value)

def label(self):
return ID_CHOICES_MAP.get(self.type, self.type)

def url(self):
return id_url(self.type, self.value)

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

class Meta:
ordering = ['title']
Expand Down Expand Up @@ -165,7 +165,7 @@ def delete(self, cascade=True, *args, **kwargs):
for work_relation in self.works_related_from.all():
work_relation.delete()
super(Work, self).delete(*args, **kwargs) # Call the "real" save() method.

def id_for(self, type):
return id_for(self, type)

Expand Down Expand Up @@ -233,7 +233,7 @@ def openlibrary_id(self):
@property
def openlibrary_url(self):
return id_url('olwk', self.openlibrary_id)

def cover_filetype(self):
if self.uses_google_cover():
return 'jpeg'
Expand Down Expand Up @@ -431,14 +431,14 @@ def mobifiles(self):

def pdffiles(self):
return EbookFile.objects.filter(edition__work=self, format='pdf').exclude(file='').order_by('-created')

def versions(self):
version_labels = []
for ebook in self.ebooks_all():
if ebook.version_label and not ebook.version_label in version_labels:
version_labels.append(ebook.version_label)
return version_labels

def formats(self):
fmts = []
for fmt in ['pdf', 'epub', 'mobi', 'html']:
Expand All @@ -450,7 +450,7 @@ def formats(self):
def remove_old_ebooks(self):
# this method is triggered after an file upload or new ebook saved
old = Ebook.objects.filter(edition__work=self, active=True).order_by('-version_iter', '-created')

# keep highest version ebook for each format and version label
done_format_versions = []
for eb in old:
Expand All @@ -459,7 +459,7 @@ def remove_old_ebooks(self):
eb.deactivate()
else:
done_format_versions.append(format_version)

# check for failed uploads.
null_files = EbookFile.objects.filter(edition__work=self, file='')
for ebf in null_files:
Expand Down Expand Up @@ -796,12 +796,12 @@ class Subject(models.Model):

class Meta:
ordering = ['name']

@classmethod
def set_by_name(cls, subject, work=None, authority=None):
''' use this method whenever you would be creating a new subject!'''
subject = subject.strip()

# make sure it's not a ; delineated list
subjects = subject.split(';')
for additional_subject in subjects[1:]:
Expand All @@ -826,12 +826,12 @@ def set_by_name(cls, subject, work=None, authority=None):
if not subject_obj.authority and authority:
subject_obj.authority = authority
subject_obj.save()

subject_obj.works.add(work)
return subject_obj
return subject_obj
else:
return None

def __unicode__(self):
return self.name

Expand Down Expand Up @@ -1123,6 +1123,7 @@ def make_mobi(self):
asking=self.asking,
source=self.file.url
)

new_mobi_ebf.file.save(path_for_file(new_mobi_ebf, None), mobi_cf)
new_mobi_ebf.save()
if self.ebook:
Expand Down Expand Up @@ -1222,7 +1223,7 @@ def version(self):
return '.{}'.format(self.version_iter)
else:
return '().{}'.format(self.version_label, self.version_iter)

def set_version(self, version):
#set both version_label and version_iter with one string with format "version.iter"
version_pattern = r'(.*)\.(\d+)$'
Expand All @@ -1232,11 +1233,11 @@ def set_version(self, version):
else:
self.version_label = version
self.save()

def set_next_iter(self):
# set the version iter to the next unused iter for that version
for ebook in Ebook.objects.filter(
edition=self.edition,
edition=self.edition,
version_label=self.version_label,
format=self.format,
provider=self.provider
Expand All @@ -1245,7 +1246,7 @@ def set_next_iter(self):
break
self.version_iter = iter + 1
self.save()

@property
def rights_badge(self):
if self.rights is None:
Expand Down
4 changes: 2 additions & 2 deletions core/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,8 @@ def test_download_page(self):

anon_client = Client()
response = anon_client.get("/work/%s/download/" % w.id, follow=True)
self.assertContains(response, "/download_ebook/%s/"% eb1.id, count=11)
self.assertContains(response, "/download_ebook/%s/"% eb2.id, count=4)
self.assertContains(response, "/download_ebook/%s/"% eb1.id, count=11)
self.assertContains(response, "/download_ebook/%s/"% eb2.id, count=5)
self.assertTrue(eb1.edition.work.is_free)
eb1.delete()
self.assertTrue(eb2.edition.work.is_free)
Expand Down
12 changes: 3 additions & 9 deletions frontend/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@ class Meta:


class CampaignPurchaseForm(forms.Form):
anonymous = forms.BooleanField(required=False,
label_suffix='',
label=_("Make this purchase anonymous"))
anonymous = forms.BooleanField(required=False, label=_("Make this purchase anonymous, please"))
offer_id = forms.IntegerField(required=False)
offer = None
library_id = forms.IntegerField(required=False)
Expand Down Expand Up @@ -348,8 +346,7 @@ def trans_extra(self):
class CampaignThanksForm(forms.Form):
anonymous = forms.BooleanField(
required=False,
label_suffix='',
label=_("Make this contribution anonymous")
label=_("Make this contribution anonymous, please")
)
preapproval_amount = forms.DecimalField(
required = True,
Expand Down Expand Up @@ -383,10 +380,7 @@ class CampaignPledgeForm(forms.Form):
def amount(self):
return self.cleaned_data["preapproval_amount"] if self.cleaned_data else None

anonymous = forms.BooleanField(
required=False,
label_suffix='',
label=_("Make this support anonymous"))
anonymous = forms.BooleanField(required=False, label=_("Make this support anonymous, please"))
ack_name = forms.CharField(
required=False,
max_length=64,
Expand Down
Loading

0 comments on commit 6535505

Please sign in to comment.