Skip to content

Commit

Permalink
Updated django to 1.4 release
Browse files Browse the repository at this point in the history
Fix bug 742812
  • Loading branch information
tallowen committed Apr 18, 2012
1 parent bd7d6d8 commit edbf6a3
Show file tree
Hide file tree
Showing 95 changed files with 89 additions and 62 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ vagrantconfig_local.yaml
docs/_build docs/_build
settings/*local.py settings/*local.py
directory directory
media/uploads media
media/cache staticfiles/uploads
staticfiles/cache
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,8 @@
[submodule "vendor"] [submodule "vendor"]
ignore = dirty ignore = dirty
path = vendor path = vendor
url = git://github.com/mozilla/mozillians-lib.git url = git://github.com/mozilla/mozillians-lib.git
[submodule "media/js/libs/tag-it"] [submodule "staticfiles/js/libs/tag-it"]
ignore = dirty ignore = dirty
path = media/js/libs/tag-it path = staticfiles/js/libs/tag-it
url = git://github.com/aehlke/tag-it.git url = git://github.com/aehlke/tag-it.git
2 changes: 1 addition & 1 deletion apps/phonebook/helpers.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def search_result(context, profile):


def gravatar( def gravatar(
email, email,
default='%simg/unknown.png' % (settings.MEDIA_URL), default='%simg/unknown.png' % (settings.STATIC_URL),
size=175, size=175,
rating='pg'): rating='pg'):
"""Return the Gravatar URL for an email address.""" """Return the Gravatar URL for an email address."""
Expand Down
2 changes: 1 addition & 1 deletion apps/phonebook/models.py
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.auth.utils import get_random_string
from django.core.mail import send_mail from django.core.mail import send_mail
from django.db import models from django.db import models
from django.dispatch import receiver from django.dispatch import receiver
from django.utils.crypto import get_random_string


from funfactory.urlresolvers import reverse from funfactory.urlresolvers import reverse
from funfactory.utils import absolutify from funfactory.utils import absolutify
Expand Down
8 changes: 1 addition & 7 deletions apps/users/models.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
from groups.models import Group, Skill from groups.models import Group, Skill
from phonebook.helpers import gravatar from phonebook.helpers import gravatar


# This is because we are using MEDIA_ROOT wrong in 1.4
from django.core.files.storage import FileSystemStorage
fs = FileSystemStorage(location=settings.UPLOAD_ROOT,
base_url='/media/uploads/')



class UserProfile(SearchMixin, models.Model): class UserProfile(SearchMixin, models.Model):
# This field is required. # This field is required.
Expand All @@ -40,8 +35,7 @@ class UserProfile(SearchMixin, models.Model):
groups = models.ManyToManyField('groups.Group') groups = models.ManyToManyField('groups.Group')
skills = models.ManyToManyField('groups.Skill') skills = models.ManyToManyField('groups.Skill')
bio = models.TextField(verbose_name=_lazy(u'Bio'), default='', blank=True) bio = models.TextField(verbose_name=_lazy(u'Bio'), default='', blank=True)
photo = ImageField(default='', blank=True, storage=fs, photo = ImageField(default='', blank=True, upload_to='userprofile/photo')
upload_to='userprofile')
display_name = models.CharField(max_length=255, default='', blank=True) display_name = models.CharField(max_length=255, default='', blank=True)
ircname = models.CharField(max_length=63, ircname = models.CharField(max_length=63,
verbose_name=_lazy(u'IRC Nickname'), verbose_name=_lazy(u'IRC Nickname'),
Expand Down
1 change: 0 additions & 1 deletion media/js/libs/tag-it
Submodule tag-it deleted from 396745
78 changes: 52 additions & 26 deletions settings/default.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


# Django settings for the mozillians project. # Django settings for the mozillians project.
import logging import logging
import os


from funfactory.manage import path from funfactory.manage import path
from funfactory import settings_base as base from funfactory import settings_base as base
Expand Down Expand Up @@ -32,11 +31,20 @@
PORT = 443 PORT = 443


## Media and templates. ## Media and templates.
TEMPLATE_DIRS = (path('apps/users/templates'), ) STATIC_URL = '/static/'

STATICFILES_DIRS = ( STATICFILES_DIRS = (
pre.UPLOAD_ROOT, path('staticfiles'),
) )


STATIC_ROOT = path('media')


MEDIA_URL = '/uploads/'

# Deprecated with django 1.4
ADMIN_MEDIA_PREFIX = None

# List of callables that know how to import templates from various sources. # List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'jingo.Loader', 'jingo.Loader',
Expand All @@ -45,8 +53,10 @@
# 'django.template.loaders.eggs.Loader', # 'django.template.loaders.eggs.Loader',
) )


TEMPLATE_CONTEXT_PROCESSORS = (base.TEMPLATE_CONTEXT_PROCESSORS + TEMPLATE_CONTEXT_PROCESSORS = list(base.TEMPLATE_CONTEXT_PROCESSORS) + [
('django_browserid.context_processors.browserid_form',)) 'django_browserid.context_processors.browserid_form',
'django.core.context_processors.static',
]


JINGO_EXCLUDE_APPS = [ JINGO_EXCLUDE_APPS = [
'bootstrapform', 'bootstrapform',
Expand Down Expand Up @@ -136,40 +146,58 @@
# On Login, we redirect through register. # On Login, we redirect through register.
LOGIN_REDIRECT_URL = '/register' LOGIN_REDIRECT_URL = '/register'


INSTALLED_APPS = list(base.INSTALLED_APPS) + [ INSTALLED_APPS = (
# These need to go in order of migration. # Local apps
'funfactory', # Content common to most playdoh-based apps.
'jingo_minify',
'tower', # for ./manage.py extract (L10n)
'cronjobs', # for ./manage.py cron * cmd line tasks

# Django contrib apps
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contrib.admin',

# Our apps. These need to go in order of migration.
'users', 'users',
'phonebook', 'phonebook',
'groups', 'groups',
'taskboard', 'taskboard',
'common', 'common',
# 'locations', # 'locations',


# Third party apps
'bootstrapform',
'csp', 'csp',
'jingo_minify', 'commonware.response.cookies',
'tower', 'django_browserid',
'cronjobs', 'djcelery',
'elasticutils', 'elasticutils',
'sorl.thumbnail', 'sorl.thumbnail',

'django.contrib.admin',
'django.contrib.auth',
'django_browserid',
'bootstrapform',

# DB migrations
'south', 'south',
# re-assert dominance of 'django_nose' 'django_nose', # Load last to enforce dominance.
'django_nose', )

]


## Auth
PWD_ALGORITHM = 'bcrypt'
HMAC_KEYS = { HMAC_KEYS = {
'2011-01-01': 'cheesecake', '2011-01-01': 'cheesecake',
'2012-01-01': 'foobar',
} }


BASE_PASSWORD_HASHERS = (
'django_sha2.hashers.BcryptHMACCombinedPasswordVerifier',
'django_sha2.hashers.SHA512PasswordHasher',
'django_sha2.hashers.SHA256PasswordHasher',
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
)

from django_sha2 import get_password_hashers
PASSWORD_HASHERS = get_password_hashers(BASE_PASSWORD_HASHERS, HMAC_KEYS)


SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_HTTPONLY = True
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"


Expand All @@ -190,9 +218,7 @@
#: Userpics will be uploaded here. #: Userpics will be uploaded here.
USERPICS_PATH = pre.NETAPP_STORAGE + '/userpics' USERPICS_PATH = pre.NETAPP_STORAGE + '/userpics'


# Django 1.4 MEDIA_ROOT = pre.NETAPP_STORAGE
# TODO fix all templates so this works.
# MEDIA_ROOT = pre.NETAPP_STORAGE


# Userpics will accessed here. # Userpics will accessed here.
USERPICS_URL = pre.UPLOAD_URL + '/userpics' USERPICS_URL = pre.UPLOAD_URL + '/userpics'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
* *
* http://docs.jquery.com/UI/Autocomplete#theming * http://docs.jquery.com/UI/Autocomplete#theming
*/ */
.ui-autocomplete { position: absolute; cursor: default; } .ui-autocomplete { position: absolute; cursor: default; }


/* workarounds */ /* workarounds */
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
Expand Down Expand Up @@ -400,8 +400,8 @@
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
.ui-button-icons-only { width: 3.4em; } .ui-button-icons-only { width: 3.4em; }
button.ui-button-icons-only { width: 3.7em; } button.ui-button-icons-only { width: 3.7em; }


/*button text element */ /*button text element */
.ui-button .ui-button-text { display: block; line-height: 1.4; } .ui-button .ui-button-text { display: block; line-height: 1.4; }
Expand Down Expand Up @@ -437,7 +437,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
*/ */
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
Expand Down Expand Up @@ -509,7 +509,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;} .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;} .ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion media/js/infinite.js → staticfiles/js/infinite.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
} }
}); });
} }

} }
}); });
}); });
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3645,7 +3645,7 @@ if ( !jQuery.support.submitBubbles ) {
}); });
// return undefined since we don't need an event listener // return undefined since we don't need an event listener
}, },

postDispatch: function( event ) { postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree // If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) { if ( event._submit_bubble ) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions staticfiles/js/libs/tag-it
Submodule tag-it added at d64a79
File renamed without changes.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<label for="id_last_name">Last Name</label> <label for="id_last_name">Last Name</label>
<span title="This field is required." class="required">*</span> <span title="This field is required." class="required">*</span>
</div> </div>

<h1 id="qunit-header">Validation Tests</h1> <h1 id="qunit-header">Validation Tests</h1>
<h2 id="qunit-banner"></h2> <h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div> <div id="qunit-testrunner-toolbar"></div>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions media/js/webtrends.js → staticfiles/js/webtrends.js
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
// WebTrends SmartSource Data Collector Tag // WebTrends SmartSource Data Collector Tag
// Version: 9.4.0 // Version: 9.4.0
// Tag Builder Version: 3.2 // Tag Builder Version: 3.2
// Created: 5/24/2011 11:49:08 PM // Created: 5/24/2011 11:49:08 PM


Expand Down Expand Up @@ -340,7 +340,7 @@ WebTrends.prototype.dcsVar=function(){
})(); })();
WT.slv=(function(){ WT.slv=(function(){
var slv="Not enabled"; var slv="Not enabled";
try{ try{
if (navigator.userAgent.indexOf('MSIE')!=-1){ if (navigator.userAgent.indexOf('MSIE')!=-1){
var sli = new ActiveXObject('AgControl.AgControl'); var sli = new ActiveXObject('AgControl.AgControl');
if (sli){ if (sli){
Expand Down Expand Up @@ -382,7 +382,7 @@ WebTrends.prototype.dcsVar=function(){
if (this.i18n){ if (this.i18n){
if (typeof(document.defaultCharset)=="string"){ if (typeof(document.defaultCharset)=="string"){
WT.le=document.defaultCharset; WT.le=document.defaultCharset;
} }
else if (typeof(document.characterSet)=="string"){ else if (typeof(document.characterSet)=="string"){
WT.le=document.characterSet; WT.le=document.characterSet;
} }
Expand Down Expand Up @@ -421,9 +421,9 @@ WebTrends.prototype.dcsEscape=function(S, REL){
if (REL!=""){ if (REL!=""){
S=S.toString(); S=S.toString();
for (var R in REL){ for (var R in REL){
if (REL[R] instanceof RegExp){ if (REL[R] instanceof RegExp){
S=S.replace(REL[R],R); S=S.replace(REL[R],R);
} }
} }
return S; return S;
} }
Expand Down Expand Up @@ -507,7 +507,7 @@ WebTrends.prototype.dcsTag=function(){
WT.dep=""; WT.dep="";
} }
for (var N in DCS){ for (var N in DCS){
if (DCS[N]&&(typeof DCS[N]!="function")){ if (DCS[N]&&(typeof DCS[N]!="function")){
P+=this.dcsA(N,DCS[N]); P+=this.dcsA(N,DCS[N]);
} }
} }
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions templates/base.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<meta name="author" content="Mozilla"> <meta name="author" content="Mozilla">


<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="{{ MEDIA_URL }}apple-touch-icon.png"> <link rel="apple-touch-icon" href="{{ STATIC_URL }}apple-touch-icon.png">
<link rel="search" type="application/opensearchdescription+xml" <link rel="search" type="application/opensearchdescription+xml"
title="{{ _('Mozillians') }}" href="{{ url('search_plugin') }}"> title="{{ _('Mozillians') }}" href="{{ url('search_plugin') }}">


{% block site_css %} {% block site_css %}
{{ css('common') }} {{ css('common') }}
{% endblock %} {% endblock %}


<link rel="shortcut icon" type="image/ico" href="{{ MEDIA_URL }}favicon.ico"> <link rel="shortcut icon" type="image/ico" href="{{ STATIC_URL }}favicon.ico">
{% block feeds %}{% endblock %} {% block feeds %}{% endblock %}
{% block extra_headers %}{% endblock %} {% block extra_headers %}{% endblock %}
</head> </head>
Expand Down Expand Up @@ -95,7 +95,7 @@
<li class="pull-right"> <li class="pull-right">
<a class="browser_id_login" href="#join_us"> <a class="browser_id_login" href="#join_us">
<img alt="{{ _('Sign in with BrowserID') }}" <img alt="{{ _('Sign in with BrowserID') }}"
src="{{ MEDIA_URL }}img/sign_in_blue.png"> src="{{ STATIC_URL }}img/sign_in_blue.png">
</a> </a>
</li> </li>
{% endif %} {% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/includes/webtrends_desktop.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Tag Builder Version: 3.1 --> <!-- Tag Builder Version: 3.1 -->
<!-- Created: 9/9/2010 8:15:41 PM --> <!-- Created: 9/9/2010 8:15:41 PM -->
#} #}
<script src="{{ MEDIA_URL }}js/webtrends.js"></script> <script src="{{ STATIC_URL }}js/webtrends.js"></script>
{# {#
<!-- ----------------------------------------------------------------------------------- --> <!-- ----------------------------------------------------------------------------------- -->
<!-- Warning: The two script blocks below must remain inline. Moving them to an external --> <!-- Warning: The two script blocks below must remain inline. Moving them to an external -->
Expand Down
8 changes: 7 additions & 1 deletion urls.py
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.conf import settings from django.conf import settings
from django.conf.urls.defaults import include, patterns, url from django.conf.urls.defaults import include, patterns, url
from django.contrib import admin from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.shortcuts import render from django.shortcuts import render
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
Expand Down Expand Up @@ -38,11 +39,16 @@ def error_page(request, template, status=None):
# In DEBUG mode, serve media files through Django, and serve error pages # In DEBUG mode, serve media files through Django, and serve error pages
# via predictable routes. Add in qunit tests. # via predictable routes. Add in qunit tests.
if settings.DEBUG: if settings.DEBUG:
# Remove leading and trailing slashes so the regex matches. # Serve media (i.e. uploads).
media_url = settings.MEDIA_URL.lstrip('/').rstrip('/') media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
urlpatterns += patterns('', urlpatterns += patterns('',
(r'^%s/(?P<path>.*)$' % media_url, 'django.views.static.serve', (r'^%s/(?P<path>.*)$' % media_url, 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}), {'document_root': settings.MEDIA_ROOT}),
)
# Serve the static files.
urlpatterns += staticfiles_urlpatterns()
# Serve the error pages.
urlpatterns += patterns('',
# Add the 404, 500, and csrf pages for testing # Add the 404, 500, and csrf pages for testing
(r'^404$', handler404), (r'^404$', handler404),
(r'^500$', handler500), (r'^500$', handler500),
Expand Down
2 changes: 1 addition & 1 deletion vendor
Submodule vendor updated 4 files
+1 −1 .gitmodules
+1 −1 src/django
+1 −1 src/django-sha2
+1 −1 src/jingo-minify

0 comments on commit edbf6a3

Please sign in to comment.