diff options
Diffstat (limited to 'postgresqleu')
25 files changed, 61 insertions, 58 deletions
diff --git a/postgresqleu/adyen/util.py b/postgresqleu/adyen/util.py index af72c0c0..3cc981d9 100644 --- a/postgresqleu/adyen/util.py +++ b/postgresqleu/adyen/util.py @@ -208,7 +208,7 @@ def process_refund(notification): manager.complete_refund( invoicerefundid, refund.refund_amount, - 0, # we don't know the fee, it'll be generically booked + 0, # we don't know the fee, it'll be generically booked settings.ACCOUNTING_ADYEN_REFUNDS_ACCOUNT, settings.ACCOUNTING_ADYEN_FEE_ACCOUNT, urls, @@ -394,7 +394,7 @@ class AdyenAPI(object): apiparam = { 'merchantAccount': settings.ADYEN_MERCHANTACCOUNT, 'modificationAmount': { - 'value': int(amount * 100), # "minor units", so cents! + 'value': int(amount * 100), # "minor units", so cents! 'currency': settings.CURRENCY_ISO, }, 'originalReference': transreference, diff --git a/postgresqleu/auth.py b/postgresqleu/auth.py index d861204a..776562d5 100644 --- a/postgresqleu/auth.py +++ b/postgresqleu/auth.py @@ -57,7 +57,7 @@ def login(request): r = Random.new() iv = r.read(16) encryptor = AES.new(SHA.new(settings.SECRET_KEY).digest()[:16], AES.MODE_CBC, iv) - cipher = encryptor.encrypt(s + ' ' * (16 - (len(s) % 16))) # pad to 16 bytes + cipher = encryptor.encrypt(s + ' ' * (16 - (len(s) % 16))) # pad to 16 bytes return HttpResponseRedirect("%s?d=%s$%s" % ( settings.PGAUTH_REDIRECT, diff --git a/postgresqleu/confreg/admin.py b/postgresqleu/confreg/admin.py index 94e0fa95..80c8a53a 100644 --- a/postgresqleu/confreg/admin.py +++ b/postgresqleu/confreg/admin.py @@ -199,7 +199,7 @@ class ConferenceRegistrationAdmin(admin.ModelAdmin): def has_change_permission(self, request, obj=None): if not obj: - return True # So they can see the change list page + return True # So they can see the change list page if request.user.is_superuser: return True else: @@ -258,7 +258,7 @@ class ConferenceSessionAdmin(admin.ModelAdmin): def has_change_permission(self, request, obj=None): if not obj: - return True # So they can see the change list page + return True # So they can see the change list page if request.user.is_superuser: return True else: @@ -367,7 +367,7 @@ class SpeakerAdminForm(ConcurrentProtectedModelForm): def clean_photofile(self): if not self.cleaned_data['photofile']: - return self.cleaned_data['photofile'] # If it's None... + return self.cleaned_data['photofile'] if isinstance(self.cleaned_data['photofile'], ImageFieldFile): # Non-modified one return self.cleaned_data['photofile'] diff --git a/postgresqleu/confreg/backendforms.py b/postgresqleu/confreg/backendforms.py index 5bc6741f..932fe4a6 100644 --- a/postgresqleu/confreg/backendforms.py +++ b/postgresqleu/confreg/backendforms.py @@ -568,7 +568,7 @@ class BackendConferenceSessionSlotForm(BackendForm): endtime=source.endtime + xform, ).save() return - yield None # Turn this into a generator + yield None # Turn this into a generator @classmethod def get_transform_example(self, targetconf, sourceconf, idlist, transformform): @@ -612,7 +612,7 @@ class BackendVolunteerSlotForm(BackendForm): max_staff=source.max_staff, ).save() return - yield None # Turn this into a generator + yield None # Turn this into a generator @classmethod def get_transform_example(self, targetconf, sourceconf, idlist, transformform): diff --git a/postgresqleu/confreg/forms.py b/postgresqleu/confreg/forms.py index 11e44829..5a9604e2 100644 --- a/postgresqleu/confreg/forms.py +++ b/postgresqleu/confreg/forms.py @@ -402,9 +402,9 @@ class SpeakerProfileForm(forms.ModelForm): def clean_photofile(self): if not self.cleaned_data['photofile']: - return self.cleaned_data['photofile'] # If it's None... + return self.cleaned_data['photofile'] if isinstance(self.cleaned_data['photofile'], ImageFieldFile): - return self.cleaned_data['photofile'] # If it's unchanged... + return self.cleaned_data['photofile'] # If it's unchanged... img = None try: diff --git a/postgresqleu/confreg/models.py b/postgresqleu/confreg/models.py index eb14972e..1e175aac 100644 --- a/postgresqleu/confreg/models.py +++ b/postgresqleu/confreg/models.py @@ -40,15 +40,15 @@ STATUS_CHOICES = ( (0, "Submitted"), (1, "Approved"), (2, "Not Accepted"), - (3, "Pending"), # Approved, but not confirmed - (4, "Reserve"), # Reserve list + (3, "Pending"), # Approved, but not confirmed + (4, "Reserve"), # Reserve list ) STATUS_CHOICES_LONG = ( (0, "Submitted, not processed yet"), (1, "Approved and confirmed"), (2, "Not Accepted"), - (3, "Pending speaker confirmation"), # Approved, but not confirmed - (4, "Reserve-listed in case of cancels/changes"), # Reserve list + (3, "Pending speaker confirmation"), # Approved, but not confirmed + (4, "Reserve-listed in case of cancels/changes"), # Reserve list ) def get_status_string(val): return (t for v, t in STATUS_CHOICES if v == val).next() diff --git a/postgresqleu/confreg/regtypes.py b/postgresqleu/confreg/regtypes.py index 6b324026..8c246652 100644 --- a/postgresqleu/confreg/regtypes.py +++ b/postgresqleu/confreg/regtypes.py @@ -11,7 +11,7 @@ def validate_speaker_registration(reg): raise ValidationError('Speaker registrations have to be done by the speaker directly') if not ConferenceSession.objects.filter(conference=reg.conference, speaker__user=reg.attendee, - status=1, # approved + status=1, # approved ).exists(): raise ValidationError('This registration type is only available if you are a confirmed speaker at this conference') @@ -28,7 +28,7 @@ def validate_speaker_or_reserve_registration(reg): raise ValidationError('Speaker registrations have to be done by the speaker directly') if not ConferenceSession.objects.filter(conference=reg.conference, speaker__user=reg.attendee, - status__in=(1, 4), # approved/reserve + status__in=(1, 4), # approved/reserve ).exists(): raise ValidationError('This registration type is only available if you are a confirmed speaker at this conference') diff --git a/postgresqleu/confreg/reporting.py b/postgresqleu/confreg/reporting.py index 2f69ca61..cba766a8 100644 --- a/postgresqleu/confreg/reporting.py +++ b/postgresqleu/confreg/reporting.py @@ -61,9 +61,9 @@ def timereport(request): # Dynamically built list of all available report types reporttypes = [] -###########################################################3 +# ##########################################################3 # Base classes for reports -###########################################################3 +# ##########################################################3 class MultiConferenceReport(object): def __init__(self, title, ylabel, conferences): self.title = title @@ -123,9 +123,9 @@ class SingleConferenceReport(object): -###########################################################3 +# ##########################################################3 # Actually report classes -###########################################################3 +# ##########################################################3 class ConfirmedRegistrationsReport(MultiConferenceReport): def __init__(self, title, conferences): super(ConfirmedRegistrationsReport, self).__init__(title, 'Number of registrations', conferences) diff --git a/postgresqleu/confreg/views.py b/postgresqleu/confreg/views.py index f159e180..07b3834e 100644 --- a/postgresqleu/confreg/views.py +++ b/postgresqleu/confreg/views.py @@ -767,7 +767,7 @@ def reg_add_options(request, confname): if new_regtype: order.newregtype = new_regtype - order.save() # So we get a PK and can add m2m values + order.save() # So we get a PK and can add m2m values for o in options: order.options.add(o) @@ -1414,7 +1414,7 @@ def callforpapers_confirm(request, confname, sessionid): if request.method == 'POST': if request.POST.has_key('is_confirmed') and request.POST['is_confirmed'] == '1': - session.status = 1 # Now approved! + session.status = 1 session.save() # We can generate the email for this right away, so let's do that for spk in session.speaker.all(): @@ -1429,7 +1429,7 @@ def callforpapers_confirm(request, confname, sessionid): sendername=conference.conferencename, receivername=spk.fullname, ) - session.lastnotifiedstatus = 1 # Now also approved + session.lastnotifiedstatus = 1 session.lastnotifiedtime = datetime.now() session.save() return HttpResponseRedirect(".") diff --git a/postgresqleu/confsponsor/admin.py b/postgresqleu/confsponsor/admin.py index dd2af919..7ef09392 100644 --- a/postgresqleu/confsponsor/admin.py +++ b/postgresqleu/confsponsor/admin.py @@ -79,7 +79,7 @@ class SponsorClaimedBenefitInline(admin.TabularInline): model = SponsorClaimedBenefit extra = 0 can_delete = False - max_num = 0 # Hackish way to say "can't add more" + max_num = 0 class LevelListFilter(admin.SimpleListFilter): title = 'Level' diff --git a/postgresqleu/confsponsor/benefitclasses/entryvouchers.py b/postgresqleu/confsponsor/benefitclasses/entryvouchers.py index 621e036a..550c8441 100644 --- a/postgresqleu/confsponsor/benefitclasses/entryvouchers.py +++ b/postgresqleu/confsponsor/benefitclasses/entryvouchers.py @@ -71,7 +71,7 @@ class EntryVouchers(BaseBenefit): # Finally, finish the claim claim.claimdata = batch.id - claim.confirmed = True # Always confirmed, they're generated after all + claim.confirmed = True # Always confirmed, they're generated after all return True def render_claimdata(self, claimedbenefit): diff --git a/postgresqleu/confsponsor/management/commands/sponsor_generate_discount_invoices.py b/postgresqleu/confsponsor/management/commands/sponsor_generate_discount_invoices.py index 83f4041c..b930c149 100644 --- a/postgresqleu/confsponsor/management/commands/sponsor_generate_discount_invoices.py +++ b/postgresqleu/confsponsor/management/commands/sponsor_generate_discount_invoices.py @@ -11,7 +11,7 @@ from datetime import date, datetime, timedelta from django.db.models import Q, F, Count from postgresqleu.confreg.models import DiscountCode -from postgresqleu.confsponsor.models import Sponsor # Required for text based resolving in DiscountCode +from postgresqleu.confsponsor.models import Sponsor from postgresqleu.mailqueue.util import send_simple_mail, send_template_mail from postgresqleu.invoices.util import InvoiceManager, InvoiceWrapper diff --git a/postgresqleu/confsponsor/views.py b/postgresqleu/confsponsor/views.py index f24d462f..768ecc05 100644 --- a/postgresqleu/confsponsor/views.py +++ b/postgresqleu/confsponsor/views.py @@ -351,11 +351,11 @@ def sponsor_claim_benefit(request, sponsorid, benefitid): # Always create a new claim here - we might support editing an existing one # sometime in the future, but not yet... claim = SponsorClaimedBenefit(sponsor=sponsor, benefit=benefit, claimedat=datetime.now(), claimedby=request.user) - claim.save() # generate an id + claim.save() # generate an id send_mail = benefitclass.save_form(form, claim, request) - claim.save() # Just in case the claimdata field was modified + claim.save() # Just in case the claimdata field was modified if send_mail: if claim.declined: diff --git a/postgresqleu/invoices/util.py b/postgresqleu/invoices/util.py index a318ccfc..7244db79 100644 --- a/postgresqleu/invoices/util.py +++ b/postgresqleu/invoices/util.py @@ -57,7 +57,7 @@ class InvoiceWrapper(object): for r in self.invoice.invoicerow_set.all(): total += r.rowamount * r.rowcount totalvat += r.totalvat - totalvat = totalvat.quantize(Decimal('.01')) # Round off to two digits + totalvat = totalvat.quantize(Decimal('.01')) # Round off to two digits self.invoice.total_amount = total + totalvat self.invoice.total_vat = totalvat diff --git a/postgresqleu/invoices/views.py b/postgresqleu/invoices/views.py index fa66e5f8..3d1dff5c 100644 --- a/postgresqleu/invoices/views.py +++ b/postgresqleu/invoices/views.py @@ -129,7 +129,7 @@ def oneinvoice(request, invoicenum): # that the invoice is really not finalized. if invoice.finalized: raise Exception("Cannot delete a finalized invoice!") - invoiceid = invoice.id # Need to save this away since we delete it + invoiceid = invoice.id # Need to save this away since we delete it invoice.delete() messages.info(request, "Invoice %s deleted." % invoiceid) return HttpResponseRedirect('/invoiceadmin/') @@ -202,9 +202,9 @@ def flaginvoice(request, invoicenum): (r, i, p) = mgr.process_incoming_payment(invoice.invoicestr, invoice.total_amount, request.POST['reason'], - 0, # We assume this was a bank payment without cost + 0, # We assume this was a bank payment without cost settings.ACCOUNTING_MANUAL_INCOME_ACCOUNT, - 0, # costaccount + 0, # costaccount logger=payment_logger) if r != InvoiceManager.RESULT_OK: @@ -321,12 +321,12 @@ def emailinvoice(request, invoicenum): return HttpResponse("OK") -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # # Views that are viewable both by admins and end users # (if they have permissions) # -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- @login_required diff --git a/postgresqleu/membership/views.py b/postgresqleu/membership/views.py index 23dade0b..42ad3163 100644 --- a/postgresqleu/membership/views.py +++ b/postgresqleu/membership/views.py @@ -54,7 +54,7 @@ def home(request): MemberLog(member=member, timestamp=datetime.now(), message="Registration received, awaiting payment").save() - registration_complete = True # So we show the payment info! + registration_complete = True # So we show the payment info! elif form.has_changed(): # Figure out what changed MemberLog(member=member, @@ -72,7 +72,7 @@ def home(request): request.user, request.user.email, request.user.first_name + ' ' + request.user.last_name, - '', # We don't have an address + '', # We don't have an address '%s membership for %s' % (settings.ORG_NAME, request.user.email), datetime.now(), datetime.now(), @@ -101,7 +101,7 @@ def home(request): 'invoice': InvoicePresentationWrapper(member.activeinvoice, "%s/membership/" % settings.SITEBASE), 'registration_complete': registration_complete, 'logdata': logdata, - 'amount': settings.MEMBERSHIP_COST, # price for settings.MEMBERSHIP_LENGTH years + 'amount': settings.MEMBERSHIP_COST, # price for settings.MEMBERSHIP_LENGTH years }) diff --git a/postgresqleu/paypal/management/commands/paypal_fetch.py b/postgresqleu/paypal/management/commands/paypal_fetch.py index 88a247d6..03c9e2ab 100644 --- a/postgresqleu/paypal/management/commands/paypal_fetch.py +++ b/postgresqleu/paypal/management/commands/paypal_fetch.py @@ -67,7 +67,7 @@ class PaypalBaseTransaction(object): if r['L_CURRENCYCODE0'][0] != settings.CURRENCY_ISO: self.message = "Invalid currency %s" % r['L_CURRENCYCODE0'][0] self.transinfo.transtext += ' (currency %s, manually adjust amount!)' % r['L_CURRENCYCODE0'][0] - self.transinfo.amount = -1 # just to be on the safe side + self.transinfo.amount = -1 # just to be on the safe side def store(self): self.transinfo.matched = False @@ -100,7 +100,7 @@ class PaypalTransfer(PaypalBaseTransaction): if apistruct.has_key('CURRENCYCODE') and apistruct['CURRENCYCODE'] != settings.CURRENCY_ISO: self.message = "Invalid currency %s" % apistruct['CURRENCYCODE'] self.transinfo.transtext += ' (currency %s, manually adjust amount!)' % apistruct['CURRENCYCODE'] - self.transinfo.amount = -1 # To be on the safe side + self.transinfo.amount = -1 # To be on the safe side def fetch_details(self, api): # We cannot fetch more details, but we also don't need more details.. diff --git a/postgresqleu/paypal/management/commands/paypal_match.py b/postgresqleu/paypal/management/commands/paypal_match.py index 192c6b4d..d45961d0 100755 --- a/postgresqleu/paypal/management/commands/paypal_match.py +++ b/postgresqleu/paypal/management/commands/paypal_match.py @@ -81,7 +81,7 @@ class Command(BaseCommand): trans.setmatched('Matched API initiated refund') # API initiated refund, so we should be able to match it invoicemanager.complete_refund( - trans.transtext[38:], # 38 is the length of the string above + trans.transtext[38:], # 38 is the length of the string above -trans.amount, -trans.fee, settings.ACCOUNTING_PAYPAL_INCOME_ACCOUNT, diff --git a/postgresqleu/settings.py b/postgresqleu/settings.py index 2598f4cc..1f59c575 100644 --- a/postgresqleu/settings.py +++ b/postgresqleu/settings.py @@ -123,7 +123,8 @@ EU_VAT_HOME_COUNTRY = "FR" # On-line validate EU vat numbers EU_VAT_VALIDATE = False -##### Membership module ##### +# Membership module +# ----------------- # Years of membership per payment MEMBERSHIP_LENGTH = 2 # Cost for membership @@ -131,7 +132,8 @@ MEMBERSHIP_COST = 10 # Function called to valide that country is acceptable for membership MEMBERSHIP_COUNTRY_VALIDATOR = None -##### Invoice module ##### +# Invoice module +# -------------- INVOICE_PDF_BUILDER = 'postgresqleu.util.misc.pgeuinvoice' # Paypal sandbox configuration @@ -182,7 +184,8 @@ ACCOUNTING_DONATIONS_ACCOUNT = 3601 ACCOUNTING_INVOICE_VAT_ACCOUNT = 2610 -##### Organisation configuration ##### +# Organisation configuration +# -------------------------- ORG_NAME = "Not Configured Organisation" ORG_SHORTNAME = "NOTCONF" # Base URLs for generating absolute URLs @@ -193,7 +196,8 @@ CSRF_COOKIE_SECURE = True DATETIME_FORMAT = "Y-m-d H:i:s" -##### Enable/disable modules ##### +# Enable/disable modules +# ---------------------- ENABLE_PG_COMMUNITY_AUTH = False ENABLE_NEWS = True ENABLE_MEMBERSHIP = False @@ -257,7 +261,8 @@ ADMINS = ( ) MANAGERS = ADMINS -##### Invoice module ##### +# Invoice module +# -------------- INVOICE_TITLE_PREFIX = u'{0} Invoice'.format(ORG_NAME) INVOICE_FILENAME_PREFIX = ORG_SHORTNAME.lower() diff --git a/postgresqleu/static/models.py b/postgresqleu/static/models.py index 54f60fe2..6b202199 100644 --- a/postgresqleu/static/models.py +++ b/postgresqleu/static/models.py @@ -1,3 +1 @@ -#from django.db import models - # Create your models here. diff --git a/postgresqleu/trustlypayment/management/commands/trustly_match_refunds.py b/postgresqleu/trustlypayment/management/commands/trustly_match_refunds.py index b66d6336..04acc66c 100644 --- a/postgresqleu/trustlypayment/management/commands/trustly_match_refunds.py +++ b/postgresqleu/trustlypayment/management/commands/trustly_match_refunds.py @@ -56,6 +56,6 @@ class Command(BaseCommand): Decimal(w['amount']), 0, settings.ACCOUNTING_TRUSTLY_ACCOUNT, - 0, # We don't support fees on Trustly at this point + 0, # We don't support fees on Trustly at this point [], method) diff --git a/postgresqleu/trustlypayment/util.py b/postgresqleu/trustlypayment/util.py index 84bd3344..474b689e 100644 --- a/postgresqleu/trustlypayment/util.py +++ b/postgresqleu/trustlypayment/util.py @@ -156,9 +156,9 @@ class Trustly(TrustlyWrapper): manager.process_incoming_payment_for_invoice(invoice, trans.amount, 'Trustly id {0}'.format(trans.id), - 0, #XXX: we pay zero now, but should perhaps support fees? + 0, # XXX: we pay zero now, but should perhaps support fees? settings.ACCOUNTING_TRUSTLY_ACCOUNT, - 0, #XXX: if supporting fees, support fee account + 0, # XXX: if supporting fees, support fee account [], invoice_logger, method) diff --git a/postgresqleu/util/middleware.py b/postgresqleu/util/middleware.py index 10c45d08..91e914cf 100644 --- a/postgresqleu/util/middleware.py +++ b/postgresqleu/util/middleware.py @@ -8,13 +8,13 @@ class FilterPersistMiddleware(object): def process_request(self, request): path = request.path - if path.find('/admin/') != -1: #Dont waste time if we are not in admin + if path.find('/admin/') != -1: # Dont waste time if we are not in admin query_string = request.META['QUERY_STRING'] if not request.META.has_key('HTTP_REFERER'): return None session = request.session - if session.get('redirected', False):#so that we dont loop once redirected + if session.get('redirected', False): # so that we dont loop once redirected del session['redirected'] return None @@ -22,18 +22,18 @@ class FilterPersistMiddleware(object): referrer = referrer[referrer.find('/admin'):len(referrer)] key = 'key' + path.replace('/', '_') - if path == referrer: #We are in same page as before - if query_string == '': #Filter is empty, delete it + if path == referrer: # We are in same page as before + if query_string == '': # Filter is empty, delete it if session.get(key, False): del session[key] return None request.session[key] = query_string - elif '_directlink=1' in query_string: # Direct link to a filter, by ourselves, so remove it + elif '_directlink=1' in query_string: # Direct link to a filter, by ourselves, so remove it redirect_to = path + '?' + query_string.replace('&_directlink=1', '') if session.has_key(key): del session[key] return http.HttpResponseRedirect(redirect_to) - else: #We are are coming from another page, restore filter if available + else: # We are are coming from another page, restore filter if available if session.get(key, False): query_string = request.session.get(key) redirect_to = path + '?' + query_string diff --git a/postgresqleu/util/storage.py b/postgresqleu/util/storage.py index 9ca09a31..dfab7747 100644 --- a/postgresqleu/util/storage.py +++ b/postgresqleu/util/storage.py @@ -33,7 +33,7 @@ class InlineEncodedStorage(Storage): return name def exists(self, name): - return False # Not sure why, but we don't need it :) + return False # Not sure why, but we don't need it :) def get_available_name(self, name, max_length=None): if max_length: diff --git a/postgresqleu/views.py b/postgresqleu/views.py index 433e9951..b913b96c 100644 --- a/postgresqleu/views.py +++ b/postgresqleu/views.py @@ -111,5 +111,5 @@ def csrf_failure(request, reason=''): resp = render(request, 'csrf_failure.html', { 'reason': reason, }) - resp.status_code = 403 # Forbidden + resp.status_code = 403 # Forbidden return resp |
