- Create an account on https://marketplace.firefox.com/developers/ and accept the terms and conditions: https://marketplace.firefox.com/developers/terms
- Ask someone with admin rights to put your user in the LangPacks Administrators group.
- Generate an API key and secret from https://marketplace.firefox.com/developers/api
- Start using the API!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import requests | |
import feedgenerator | |
from dateutil.parser import parse | |
from raven import Client | |
REPO = 'django/django' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@register.simple_tag(takes_context=True) | |
def clamp_pagination(context, key): | |
""" | |
Force number of pages to be never be more than PAGINATION_FIXED_NB_PAGES | |
""" | |
paginator = context.get('paginator') | |
page_obj = context.get('page_obj') | |
if paginator and page_obj: | |
max_num_pages = getattr(settings, 'PAGINATION_FIXED_NB_PAGES', 10) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.cache.backends import memcached | |
import pylibmc | |
import logging | |
log = logging.getLogger('django.core.cache.backends.memcached') | |
class BinaryPyLibMCCache(memcached.PyLibMCCache): | |
""" | |
Custom cache backend using pylibmc that enables binary protocol |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import logging | |
from optparse import make_option | |
from django.core.management.base import BaseCommand, CommandError | |
class Command(BaseCommand): | |
help = ("Invalidates portions of the queryset cache based on the app names" | |
" or models provided as arguments to the command. If no arguments " | |
"are provided, nothing is done. To clear the entire queryset " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Foo(models.Model): | |
bar = models.PositiveSmallIntegerField(default=1) | |
class Meta: | |
ordering = ['bar'] | |
class Child(Foo): | |
barchild = models.PositiveSmallIntegerField(default=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: __init__.py | |
=================================================================== | |
--- __init__.py (revision 4) | |
+++ __init__.py (working copy) | |
@@ -39,17 +39,24 @@ | |
def __init__(self): | |
rb.Plugin.__init__(self) | |
- def queue_random_album(self): | |
+ def get_random_album_first_song(self): |