Permalink
Browse files

New vendor, working.

Import fixes.

test fixes. still broken on auth.
  • Loading branch information...
1 parent 7c05326 commit 684d634e4dbac4e48a1486d441e85f35ebb36e5f @glogiotatidis glogiotatidis committed Jul 2, 2013
Showing 346 changed files with 13,906 additions and 285 deletions.
View
@@ -1,4 +1,4 @@
-settings_local.py
+mozillians/settings/local.py
*.py[co]
*.sw[po]
.coverage
View
@@ -1,7 +1,3 @@
-[submodule "vendor"]
- ignore = dirty
- path = vendor
- url = git://github.com/mozilla/mozillians-lib.git
[submodule "media/js/libs/tag-it"]
ignore = dirty
path = media/js/libs/tag-it
@@ -15,3 +11,28 @@
[submodule "vendor-local/src/django-autocomplete-light"]
path = vendor-local/src/django-autocomplete-light
url = git://github.com/yourlabs/django-autocomplete-light
+[submodule "vendor-local/src/django-bootstrap-form"]
+ path = vendor-local/src/django-bootstrap-form
+ url = https://github.com/tallowen/django-bootstrap-form
+[submodule "vendor"]
+ ignore = dirty
+ path = vendor
+ url = git://github.com/mozilla/playdoh-lib
+[submodule "vendor-local/src/elasticutils"]
+ path = vendor-local/src/elasticutils
+ url = git://github.com/mozilla/elasticutils
+[submodule "vendor-local/src/pyes"]
+ path = vendor-local/src/pyes
+ url = git://github.com/aparo/pyes
+[submodule "vendor-local/src/django-tastypie"]
+ path = vendor-local/src/django-tastypie
+ url = git://github.com/toastdriven/django-tastypie
+[submodule "vendor-local/src/pystatsd"]
+ path = vendor-local/src/pystatsd
+ url = git://github.com/jsocol/pystatsd
+[submodule "vendor-local/src/django-csp"]
+ path = vendor-local/src/django-csp
+ url = git://github.com/mozilla/django-csp
+[submodule "vendor-local/src/django-browserid"]
+ path = vendor-local/src/django-browserid
+ url = git://github.com/mozilla/django-browserid
View
@@ -1,14 +0,0 @@
-from django.conf.urls.defaults import patterns, url
-from django.contrib.auth import views as auth_views
-
-from jinjautils import jinja_for_django
-
-from users import views
-
-# So we can use the contrib logic for password resets, etc.
-auth_views.render_to_response = jinja_for_django
-
-
-urlpatterns = patterns('',
- url(r'^logout/$', views.logout, name='logout'),
- url(r'^register/$', views.register, name='register'))
View
@@ -2,24 +2,22 @@
import os
import sys
-try:
- # For local development in a virtualenv:
- from funfactory import manage
-except ImportError:
- # Production:
- # Add a temporary path so that we can import the funfactory
- tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
- 'vendor', 'src', 'funfactory')
- sys.path.append(tmp_path)
+# Edit this if necessary or override the variable in your environment.
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mozillians.settings')
- from funfactory import manage
+# Add a temporary path so that we can import the funfactory
+tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ 'vendor', 'src', 'funfactory')
+# Comment out to load funfactory from your site packages instead
+sys.path.insert(0, tmp_path)
- # Let the path magic happen in setup_environ() !
- sys.path.remove(tmp_path)
+from funfactory import manage
+# Let the path magic happen in setup_environ() !
+sys.path.remove(tmp_path)
-manage.setup_environ(__file__)
+
+manage.setup_environ(__file__, more_pythonic=True)
if __name__ == "__main__":
manage.main()
-
File renamed without changes.
@@ -3,9 +3,9 @@
from mock import patch
from nose.tools import eq_, ok_
-from apps.common.tests.init import ESTestCase
-from ..helpers import latest_announcement
-from ..models import Announcement
+from mozillians.announcements.helpers import latest_announcement
+from mozillians.announcements.models import Announcement
+from mozillians.common.tests.init import ESTestCase
class AnnouncementsTests(ESTestCase):
@@ -23,7 +23,7 @@ def setUp(self):
publish_from=datetime(2013, 2, 21),
publish_until=datetime(2013, 2, 23))
- @patch('announcements.models.datetime')
+ @patch('mozillians.announcements.models.datetime')
def test_manager_published(self, mock_obj):
"""Test published() of Announcement Manager."""
mock_obj.now.return_value = datetime(2013, 2, 10)
@@ -41,10 +41,9 @@ def test_manager_published(self, mock_obj):
mock_obj.now.return_value = datetime(2013, 2, 24)
eq_(Announcement.objects.published().count(), 0)
- @patch('announcements.models.datetime')
+ @patch('mozillians.announcements.models.datetime')
def test_manager_unpublished(self, mock_obj):
"""Test unpublished() of Announcement Manager."""
-
mock_obj.now.return_value = datetime(2013, 2, 10)
eq_(Announcement.objects.unpublished().count(), 3)
@@ -60,7 +59,7 @@ def test_manager_unpublished(self, mock_obj):
mock_obj.now.return_value = datetime(2013, 2, 24)
eq_(Announcement.objects.unpublished().count(), 3)
- @patch('announcements.models.datetime')
+ @patch('mozillians.announcements.models.datetime')
def test_published(self, mock_obj):
"""Test published model property."""
@@ -69,7 +68,7 @@ def test_published(self, mock_obj):
ok_(self.second.published)
ok_(not self.third.published)
- @patch('announcements.models.datetime')
+ @patch('mozillians.announcements.models.datetime')
def test_announcement_helper(self, mock_obj):
"""Test latest announcement helper."""
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
from django_statsd.clients import statsd
from tastypie.authorization import ReadOnlyAuthorization
-from models import APIApp
+from mozillians.api.models import APIApp
class MozillaOfficialAuthorization(ReadOnlyAuthorization):
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -2,10 +2,10 @@
from tastypie.api import Api
-import apps.users.api
+import mozillians.users.api
v1_api = Api(api_name='v1')
-v1_api.register(apps.users.api.UserResource())
+v1_api.register(mozillians.users.api.UserResource())
urlpatterns = patterns('',
url(r'', include(v1_api.urls)),
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,9 +1,8 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
from datetime import datetime
+
def current_year(request):
return {"current_year": datetime.today().year}
-
File renamed without changes.
File renamed without changes.
@@ -61,7 +61,7 @@ def bootstrap(element):
@register.function
def get_privacy_level(user):
"""Return privacy level user."""
- from apps.users.models import PUBLIC
+ from mozillians.users.models import PUBLIC
if not user.is_authenticated():
return PUBLIC
return user.userprofile.level
@@ -11,7 +11,7 @@
from tower import ugettext as _
from tower import ugettext_lazy as _lazy
-from apps.groups.models import Group, GroupAlias
+from mozillians.groups.models import Group, GroupAlias
LOGIN_MESSAGE = _lazy(u'You must be logged in to continue.')
GET_VOUCHED_MESSAGE = _lazy(u'You must be vouched to continue.')
@@ -9,8 +9,8 @@
import test_utils
import elasticutils.contrib.django.estestcase as estestcase
-from apps.users.cron import index_all_profiles
-from apps.users.models import MOZILLIANS, PUBLIC, UserProfile
+from mozillians.users.cron import index_all_profiles
+from mozillians.users.models import MOZILLIANS, PUBLIC, UserProfile
class TestCase(test_utils.TestCase):
@@ -20,7 +20,8 @@ class TestCase(test_utils.TestCase):
def setUpClass(cls):
super(TestCase, cls).setUpClass()
cls._AUTHENTICATION_BACKENDS = settings.AUTHENTICATION_BACKENDS
- settings.AUTHENTICATION_BACKENDS = ['common.backends.TestBackend']
+ settings.AUTHENTICATION_BACKENDS = [
+ 'mozillians.common.backends.TestBackend']
# Create a Mozillian
cls.mozillian = User.objects.create(
@@ -1,8 +1,8 @@
from django.core.urlresolvers import reverse
from nose.tools import eq_
-from apps.common.tests.init import ESTestCase
-from apps.common.decorators import allow_public, allow_unvouched
+from mozillians.common.tests.init import ESTestCase
+from mozillians.common.decorators import allow_public, allow_unvouched
class TestDecorators(ESTestCase):
@@ -27,7 +27,7 @@ def foo():
class TestStrongholdMiddleware(ESTestCase):
"""Stronghold Testcases."""
- urls = 'apps.common.tests.test_urls'
+ urls = 'mozillians.common.tests.test_urls'
def test_stronghold(self):
"""Test stronhold middleware functionality."""
@@ -1,9 +1,9 @@
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.http import HttpResponse
-from apps.common.decorators import allow_public, allow_unvouched
+from mozillians.common.decorators import allow_public, allow_unvouched
-from urls import urlpatterns
+from mozillians.urls import urlpatterns
def vouched(request):
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -4,9 +4,9 @@
import bleach
-from apps.groups.models import Group, Language, Skill
-from apps.mozspaces.models import MozSpace
-from apps.users.models import UserProfile
+from mozillians.groups.models import Group, Language, Skill
+from mozillians.mozspaces.models import MozSpace
+from mozillians.users.models import UserProfile
ALLOWED_TAGS = ['em', 'strong']
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,15 +8,15 @@
from nose.tools import eq_
from pyquery import PyQuery as pq
-import apps.common.tests.init
+import mozillians.common.tests.init
-from ..cron import assign_autocomplete_to_groups
-from ..helpers import stringify_groups
-from ..models import AUTO_COMPLETE_COUNT, Group, GroupAlias
-from ..utils import merge_groups
+from mozillians.groups.cron import assign_autocomplete_to_groups
+from mozillians.groups.helpers import stringify_groups
+from mozillians.groups.models import AUTO_COMPLETE_COUNT, Group, GroupAlias
+from mozillians.groups.utils import merge_groups
-class GroupTest(apps.common.tests.init.ESTestCase):
+class GroupTest(mozillians.common.tests.init.ESTestCase):
"""Test the group/grouping system."""
def setUp(self):
@@ -5,13 +5,13 @@
from funfactory.urlresolvers import reverse
from nose.tools import eq_
-import apps.common.tests.init
+import mozillians.common.tests.init
-from ..cron import assign_autocomplete_to_groups
-from ..models import AUTO_COMPLETE_COUNT, Language
+from mozillians.groups.cron import assign_autocomplete_to_groups
+from mozillians.groups.models import AUTO_COMPLETE_COUNT, Language
-class LanguagesTest(apps.common.tests.init.ESTestCase):
+class LanguagesTest(mozillians.common.tests.init.ESTestCase):
def test_autocomplete_api(self):
r = self.mozillian_client.get(reverse('language_search'),
@@ -1,7 +1,7 @@
from django.core.urlresolvers import reverse
from nose.tools import eq_
-from apps.common.tests.init import ESTestCase
+from mozillians.common.tests.init import ESTestCase
from ..models import Group, GroupAlias
@@ -5,13 +5,13 @@
from funfactory.urlresolvers import reverse
from nose.tools import eq_
-import apps.common.tests.init
+import mozillians.common.tests.init
-from ..cron import assign_autocomplete_to_groups
-from ..models import AUTO_COMPLETE_COUNT, Skill
+from mozillians.groups.cron import assign_autocomplete_to_groups
+from mozillians.groups.models import AUTO_COMPLETE_COUNT, Skill
-class SkillsTest(apps.common.tests.init.ESTestCase):
+class SkillsTest(mozillians.common.tests.init.ESTestCase):
def test_autocomplete_api(self):
r = self.mozillian_client.get(reverse('skill_search'),
@@ -1,9 +1,9 @@
from nose.tools import eq_
-from apps.common.tests.init import ESTestCase
+from mozillians.common.tests.init import ESTestCase
-from apps.groups.models import Group, Skill
-from apps.groups.tasks import remove_empty_groups
+from mozillians.groups.models import Group, Skill
+from mozillians.groups.tasks import remove_empty_groups
class EmptyGroupsTest(ESTestCase):
"""Test Empty Group Removal."""
File renamed without changes.
File renamed without changes.
@@ -10,11 +10,11 @@
import commonware.log
from funfactory.urlresolvers import reverse
-from apps.common.decorators import allow_unvouched
-from apps.groups.models import Group, Skill
-from apps.groups.forms import SortForm
-from apps.phonebook import forms
-from apps.users.tasks import update_basket_task
+from mozillians.common.decorators import allow_unvouched
+from mozillians.groups.models import Group, Skill
+from mozillians.groups.forms import SortForm
+from mozillians.phonebook import forms
+from mozillians.users.tasks import update_basket_task
log = commonware.log.getLogger('m.groups')
File renamed without changes.
File renamed without changes.
@@ -1,14 +1,14 @@
-import uuid
import os
+import uuid
from django.conf import settings
-from django.db import models
from django.contrib.auth.models import User
-
+from django.db import models
from product_details import product_details
from pytz import common_timezones
from sorl.thumbnail import ImageField
+
COUNTRIES = product_details.get_regions('en-US').items()
COUNTRIES = sorted(COUNTRIES, key=lambda country: country[1])
File renamed without changes.
File renamed without changes.
@@ -9,12 +9,12 @@
from pytz import common_timezones
from tower import ugettext as _, ugettext_lazy as _lazy
-from apps.groups.models import Group, Skill, Language
-from apps.phonebook.widgets import MonthYearWidget
-from apps.users.helpers import validate_username
-from apps.users.models import User, UserProfile
+from mozillians.groups.models import Group, Skill, Language
+from mozillians.phonebook.models import Invite
+from mozillians.phonebook.widgets import MonthYearWidget
+from mozillians.users.helpers import validate_username
+from mozillians.users.models import User, UserProfile
-from models import Invite
PAGINATION_LIMIT = 20
PAGINATION_LIMIT_LARGE = 50
File renamed without changes.
File renamed without changes.
Oops, something went wrong.

0 comments on commit 684d634

Please sign in to comment.