Skip to content

Instantly share code, notes, and snippets.

View andymckay's full-sized avatar

Andy McKay andymckay

View GitHub Profile
# a URL field that supports webcal:// links for Django
#
from django.forms.fields import URLField, URL_VALIDATOR_USER_AGENT, RegexField
import re
url_re = re.compile(
r'^(https?|webcal)://' # http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?|' #domain...
r'localhost|' #localhost...
# using dateutil (easy_install python-dateutil) allows you to
# filter dates to a particular timezone eg:
# {{ hour.object|astimezone:'US/Eastern'|date:'G'}}
from django import template
from django.conf import settings
from dateutil import zoneinfo
register = template.Library()
diff --git a/apps/files/tests.py b/apps/files/tests.py
index 2b699cb..6f0c318 100644
--- a/apps/files/tests.py
+++ b/apps/files/tests.py
@@ -29,7 +29,7 @@ class TestFile(test_utils.TestCase):
filesystem """
file = File.objects.get(pk=67442)
filename = file.file_path
- if not os.path.exists:
+ if not os.path.exists(os.path.dirname(filename)):
diff --git a/apps/devhub/views.py b/apps/devhub/views.py
index 80b4e98..b0c0c30 100644
--- a/apps/devhub/views.py
+++ b/apps/devhub/views.py
@@ -305,6 +305,14 @@ def version_edit(request, addon_id, addon, version_id):
all([form.is_valid() for form in data.values()])):
data['version_form'].save()
data['file_form'].save()
+
+ for deleted in data['file_form'].deleted_forms:
diff --git a/apps/devhub/views.py b/apps/devhub/views.py
index 80b4e98..0938ca2 100644
--- a/apps/devhub/views.py
+++ b/apps/devhub/views.py
@@ -22,6 +22,7 @@ from addons.forms import (AddonFormBasic, AddonFormDetails, AddonFormSupport,
AddonFormTechnical)
from addons.models import Addon, AddonUser, AddonLog
from addons.views import BaseFilter
+from devhub.models import ActivityLog
from files.models import FileUpload
diff --git a/apps/addons/templates/addons/report_abuse.html b/apps/addons/templates/addons/report_abuse.html
index 48b3909..24b484d 100644
--- a/apps/addons/templates/addons/report_abuse.html
+++ b/apps/addons/templates/addons/report_abuse.html
@@ -4,6 +4,12 @@
{% if hide %}<legend><a href="#">{{ _('Report Abuse') }}</a></legend>{% endif %}
<ol>
<li>
+ <p>{% trans url=remora_url('developers/docs/policies') %}
+ If you suspect this add-on violates <a href="{{ url }}">our policies</a> or
diff --git a/media/js/zamboni/init.js b/media/js/zamboni/init.js
index f69438b..0649971 100644
--- a/media/js/zamboni/init.js
+++ b/media/js/zamboni/init.js
@@ -5,7 +5,9 @@ $(document).ready(function(){
// Initialize install buttons.
$('.install').installButton();
- $('.backup-button').showBackupButton();
+ if ($('.backup-button').length) {
diff --git a/media/js/zamboni/devhub.js b/media/js/zamboni/devhub.js
index 7ad3a52..90f79d9 100644
--- a/media/js/zamboni/devhub.js
+++ b/media/js/zamboni/devhub.js
@@ -96,7 +96,8 @@ $(document).ready(function() {
}
// when to start and stop image polling
- if ($('#edit-addon-media').length) {
+ if ($('#edit-addon-media').length &&
@andymckay
andymckay / gist:915856
Created April 12, 2011 16:35
Cope with deleted addons
Index: maintenance.py
===================================================================
--- maintenance.py (revision 87210)
+++ maintenance.py (working copy)
@@ -61,6 +61,7 @@
REPLACE INTO stats_share_counts_totals (addon_id, service, count)
(SELECT addon_id, service, SUM(count)
FROM stats_share_counts
+ RIGHT JOIN addons ON addon_id = addons.id
WHERE service IN (%s)
diff --git a/apps/editors/models.py b/apps/editors/models.py
index 58eb5d7..a6d5962 100644
--- a/apps/editors/models.py
+++ b/apps/editors/models.py
@@ -216,7 +216,10 @@ class EditorSubscription(amo.models.ModelBase):
def send_notifications(sender, instance, **kw):
- if kw.get('raw') or not kw.get('created') or instance.is_beta:
+ # Using instance.is_beta uses all_files which is heavily cached and