зеркало из https://github.com/mozilla/batucada.git
Removing unused and ambiguous imports
This commit is contained in:
Родитель
e420ae2182
Коммит
b4f7e66027
|
@ -1,9 +1,8 @@
|
|||
from django.db import models
|
||||
from django.db.models import Q
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes import generic
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.timesince import timesince
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from django.contrib.auth.models import User, Group
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
||||
class UnknownActivityError(Exception):
|
||||
"""Can't find a specified activity verb or object-type."""
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
|
@ -16,12 +17,12 @@ class Type(object):
|
|||
|
||||
past_tense = None
|
||||
ns = 'http://activitystrea.ms/schema/1.0'
|
||||
|
||||
|
||||
def __init__(self, name, past_tense=None):
|
||||
self.abbrev_name = name
|
||||
self.name = "%(namespace)s/%(name)s" % {
|
||||
'namespace': self.ns,
|
||||
'name': name
|
||||
'name': name,
|
||||
}
|
||||
self.past_tense = past_tense
|
||||
|
||||
|
@ -33,17 +34,18 @@ class Type(object):
|
|||
if capitalize:
|
||||
term = term.capitalize()
|
||||
if noun:
|
||||
p = lambda t: (t[0] in 'aeio' and _('an %(term)s' % {'term':t})
|
||||
or _('a %(term)s' % {'term':t}))
|
||||
p = lambda t: (t[0] in 'aeio' and _('an %(term)s' % {'term': t})
|
||||
or _('a %(term)s' % {'term': t}))
|
||||
return p(term)
|
||||
return term
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.name == other or self.abbrev_name == other
|
||||
|
||||
|
||||
|
||||
class DerivedType(Type):
|
||||
"""Represent an entity defined by this site. Should extend a base type."""
|
||||
|
||||
|
||||
ns = 'http://drumbeat.org/activity/schema/1.0'
|
||||
|
||||
def __init__(self, name, parent, past_tense=None):
|
||||
|
@ -54,7 +56,7 @@ class DerivedType(Type):
|
|||
type_names = [
|
||||
'article', 'audio', 'bookmark', 'comment', 'file', 'folder', 'group',
|
||||
'note', 'person', 'photo', 'photo-album', 'place', 'playlist', 'product',
|
||||
'review', 'service', 'status', 'video', 'event', 'song'
|
||||
'review', 'service', 'status', 'video', 'event', 'song',
|
||||
]
|
||||
object_types = {}
|
||||
for name in type_names:
|
||||
|
@ -78,18 +80,17 @@ verbs = {
|
|||
'rsvp-maybe': Type('rsvp-maybe', past_tense=_('might be attending')),
|
||||
}
|
||||
|
||||
# Custom types
|
||||
# Custom types
|
||||
object_types.update({
|
||||
'project': DerivedType('project', object_types['group']),
|
||||
'project': DerivedType('project', object_types['group']),
|
||||
})
|
||||
|
||||
# Custom verbs
|
||||
verbs.update({
|
||||
'create': DerivedType('create',
|
||||
verbs['post'],
|
||||
past_tense=_('created')),
|
||||
'create': DerivedType('create', verbs['post'], past_tense=_('created')),
|
||||
})
|
||||
|
||||
|
||||
def object_type(obj):
|
||||
"""
|
||||
Given an object, determine its type, either through inference in the case
|
||||
|
|
|
@ -2,7 +2,7 @@ from django.contrib.auth.models import User, Group
|
|||
from django.test import TestCase, Client
|
||||
|
||||
import activity
|
||||
from activity.schema import verbs, object_types, UnknownActivityError
|
||||
from activity.schema import UnknownActivityError
|
||||
from activity.models import Activity
|
||||
|
||||
class ActivityTests(TestCase):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
from activity.feeds import UserActivityAtomFeed, UserNewsActivityAtomFeed, ObjectActivityAtomFeed
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', 'dashboard.views.index', name='dashboard_index'),
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
|
||||
from messages.models import inbox_count_for
|
||||
|
||||
from activity.models import Activity
|
||||
from profiles.models import Profile
|
||||
from users.decorators import anonymous_only
|
||||
|
||||
@anonymous_only
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import re
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
|
|
|
@ -53,7 +53,7 @@ def user_save_handler(sender, **kwargs):
|
|||
if user is None:
|
||||
return
|
||||
try:
|
||||
profile = user.get_profile()
|
||||
user.get_profile()
|
||||
except Profile.DoesNotExist:
|
||||
Profile(
|
||||
user=user,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^edit/$', 'profiles.views.edit',
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.shortcuts import render_to_response
|
|||
from django.template import RequestContext
|
||||
|
||||
from profiles.forms import ImageForm, ProfileForm, InterestForm, SkillForm
|
||||
from profiles.models import Profile, Skill, Interest
|
||||
from profiles.models import Skill, Interest
|
||||
|
||||
def delete_profile_element(request, param_name, cls, viewname):
|
||||
"""Delete a skill, interest, number, etc from users profile."""
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.contrib.auth.models import User
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.db.models.signals import post_save
|
||||
from django.template.defaultfilters import slugify
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^gallery/$', 'projects.views.gallery',
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import re
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.contrib.contenttypes import generic
|
|||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.db.models.signals import pre_save, pre_delete
|
||||
from django.db.models.signals import pre_save
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
import activity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^following/', 'relationships.views.following',
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^(?P<status_id>\d+)/$', 'statuses.views.show',
|
||||
|
|
|
@ -5,13 +5,11 @@ import urllib
|
|||
from django.contrib import auth
|
||||
from django.contrib.auth import models as auth_models
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils.translation import ugettext as _
|
||||
from openid.consumer.consumer import SUCCESS
|
||||
from openid.consumer.discover import DiscoveryFailure
|
||||
from openid.consumer.consumer import Consumer, SUCCESS, CANCEL, FAILURE
|
||||
from openid.consumer.consumer import SUCCESS, CANCEL, FAILURE
|
||||
from openid.extensions import sreg, ax
|
||||
|
||||
from django_openid_auth.auth import OpenIDBackend
|
||||
|
@ -217,7 +215,7 @@ class CustomOpenIDBackend(OpenIDBackend):
|
|||
registering = request.GET.get('registration', False)
|
||||
|
||||
try:
|
||||
user_openid = UserOpenID.objects.get(
|
||||
UserOpenID.objects.get(
|
||||
claimed_id__exact=openid_response.identity_url)
|
||||
except UserOpenID.DoesNotExist:
|
||||
if registering:
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import hashlib
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from users import auth
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import hashlib
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import IntegrityError
|
||||
from django.test import Client, TestCase
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^login/', 'users.views.login',
|
||||
|
|
|
@ -5,9 +5,8 @@ from django.contrib.auth.decorators import login_required
|
|||
from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect, Http404
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче