Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

django 1.4

  • Loading branch information...
commit 93be40867554749b88e4ddbae88a19c12a4ac321 1 parent 2e8870d
Justine Tunney authored
View
3  occupywallst/admin.py
@@ -7,7 +7,8 @@
"""
-from django.utils.html import escape, urlquote
+from django.utils.html import escape
+from django.utils.http import urlquote
from django.contrib import admin, messages
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404
View
5 occupywallst/middleware.py
@@ -12,11 +12,6 @@
from django.utils.cache import add_never_cache_headers
-class PrintException(object):
- def process_exception(self, request, exception):
- traceback.print_exc()
-
-
class NeverCache(object):
def process_response(self, request, response):
add_never_cache_headers(response)
View
69 occupywallst/settings.py
@@ -103,7 +103,8 @@
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_HTTPONLY = True
CSRF_COOKIE_SECURE = False
-TIME_ZONE = 'UTC'
+USE_TZ = True
+TIME_ZONE = "US/Eastern"
DEFAULT_CHARSET = 'utf-8'
ROOT_URLCONF = 'occupywallst.urls'
LOGIN_URL = '/login/'
@@ -112,8 +113,9 @@
MEDIA_URL = '/media/'
STATIC_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/media/admin/'
+SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
# SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
-SESSION_ENGINE = 'occupywallst.memcachedjson'
+# SESSION_ENGINE = 'occupywallst.memcachedjson'
USE_X_FORWARDED_HOST = True
ROSETTA_MESSAGES_PER_PAGE = 25
@@ -181,6 +183,69 @@
'south',
]
+LOGGING = {
+ "version": 1,
+ "disable_existing_loggers": True,
+ "formatters": {
+ "verbose": {
+ "format": (GREEN + "%(asctime)s %(levelname)s "
+ "[%(filename)s:%(lineno)d] " + RESET + "%(message)s"),
+ },
+ "simple": {
+ "format": GREEN + "%(levelname)s " + RESET + "%(message)s",
+ },
+ "nocolor": {
+ "format": ("%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] "
+ "%(message)s"),
+ },
+ },
+ "handlers": {
+ "null": {
+ "level": "DEBUG",
+ "class": "django.utils.log.NullHandler",
+ },
+ "console": {
+ "level": "DEBUG",
+ "class": "logging.StreamHandler",
+ "formatter": "simple",
+ },
+ "mail_admins": {
+ "level": "ERROR",
+ "class": "django.utils.log.AdminEmailHandler",
+ "include_html": True,
+ },
+ "occupywallst_file": {
+ "level": "INFO",
+ "class": "logging.FileHandler",
+ "formatter": "nocolor",
+ "filename": join(project_root, "../../log/occupywallst.log"),
+ },
+ "cdrproc_file": {
+ "level": "INFO",
+ "class": "logging.FileHandler",
+ "formatter": "nocolor",
+ "filename": join(project_root, "../../log/cdrproc.log"),
+ },
+ },
+ "loggers": {
+ "django": {
+ "level": "WARNING",
+ "handlers": ["console"],
+ "propagate": True,
+ },
+ "django.request": {
+ "level": "WARNING",
+ "handlers": ["console", "mail_admins"],
+ "propagate": False,
+ },
+ "occupywallst": {
+ "level": "WARNING",
+ "handlers": ["console", "occupywallst_file", "mail_admins"],
+ "propagate": False,
+ },
+ },
+}
+
try:
from occupywallst.settings_local import *
except ImportError:
View
68 occupywallst/settings_dev.py
@@ -1,4 +1,3 @@
-
import sys
from occupywallst.settings import *
@@ -14,65 +13,18 @@
'127.0.0.1',
]
-MIDDLEWARE_CLASSES += ['occupywallst.middleware.PrintException']
-
-# MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware']
-# INSTALLED_APPS += ['debug_toolbar']
-
-LOGGING = {
- 'version': 1,
- 'disable_existing_loggers': True,
- 'formatters': {
- 'verbose': {
- 'format': (GREEN + '%(asctime)s %(levelname)s %(name)s '
- '%(filename)s:%(lineno)d ' + RESET + '%(message)s'),
- },
- 'simple': {
- 'format': GREEN + '%(levelname)s ' + RESET + '%(message)s',
- },
- },
- 'handlers': {
- 'null': {
- 'level': 'DEBUG',
- 'class': 'django.utils.log.NullHandler',
- },
- 'console': {
- 'level': 'DEBUG',
- 'class': 'logging.StreamHandler',
- 'formatter': 'simple',
- },
- 'mail_admins': {
- 'level': 'ERROR',
- 'class': 'django.utils.log.AdminEmailHandler',
- 'include_html': True,
- },
- },
- 'loggers': {
- 'django': {
- 'level': 'WARNING',
- 'handlers': ['console'],
- 'propagate': True,
- },
- 'django.request': {
- 'level': 'WARNING',
- 'handlers': ['console', 'mail_admins'],
- 'propagate': False,
- },
- 'occupywallst': {
- 'level': 'WARNING',
- 'handlers': ['console', 'mail_admins'],
- 'propagate': False,
- },
- },
+MIDDLEWARE_CLASSES += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
+INSTALLED_APPS += ["debug_toolbar"]
+DEBUG_TOOLBAR_CONFIG = {
+ 'INTERCEPT_REDIRECTS': False,
}
-LOGGING['loggers']['django']['level'] = 'DEBUG'
-LOGGING['loggers']['django.request']['level'] = 'DEBUG'
-LOGGING['loggers']['occupywallst']['level'] = 'DEBUG'
-LOGGING['handlers']['console']['formatter'] = 'verbose'
-LOGGING['handlers']['mail_admins'] = {'level': 'DEBUG',
- 'class': 'django.utils.log.NullHandler'}
-
+LOGGING["loggers"]["django"]["level"] = "DEBUG"
+LOGGING["loggers"]["django.request"]["level"] = "DEBUG"
+LOGGING["loggers"]["occupywallst"]["level"] = "DEBUG"
+LOGGING["handlers"]["console"]["formatter"] = "verbose"
+LOGGING["handlers"]["mail_admins"] = {"level": "DEBUG",
+ "class": "django.utils.log.NullHandler"}
try:
from occupywallst.settings_dev_local import *
View
15 occupywallst/tests.py
@@ -13,6 +13,7 @@
from datetime import datetime
from itertools import product
+import redisbayes
from django.conf import settings
from django.test import TestCase
from django.contrib.gis.geos import Point
@@ -133,7 +134,8 @@ def new_article(user, **kwargs):
title=random_words(7),
slug=random_slug(),
content=random_words(20),
- is_forum=True)
+ is_forum=True,
+ is_visible=True)
vals.update(kwargs)
return db.Article.objects.create(**vals)
@@ -215,7 +217,8 @@ def create_users(self):
self.mod_user.userinfo.save()
def setUp(self):
- settings.OWS_LIMIT_VOTES = -1
+ redisbayes.RedisBayes().flush()
+ settings.OWS_LIMIT_VOTES = ()
settings.OWS_LIMIT_THREAD = -1
settings.OWS_LIMIT_COMMENT = -1
settings.OWS_LIMIT_MSG_DAY = 999999
@@ -755,13 +758,13 @@ def test_api_login_and_logout(self):
assert j['status'] == 'OK', jdump(j)
assert j['results'][0]['username'] == 'red', jdump(j)
- # logging in again should fail
+ # logging in again should succeed
response = self.client.post('/api/login/',
{'username': 'blue',
'password': 'blue'})
j = assert_and_get_valid_json(response)
- assert j['status'] == 'ERROR', jdump(j)
- assert 'already logged in' in j['message'], jdump(j)
+ assert j['status'] == 'OK', jdump(j)
+ assert j['results'][0]['username'] == 'blue', jdump(j)
# logging out and in should succeed
response = self.client.post('/api/logout/')
@@ -888,7 +891,7 @@ def test_api_article(self):
response = self.client.post('/api/article_delete/',
{'article_slug': a.slug})
j = assert_and_get_valid_json(response)
- assert j['status'] == 'ERROR' # TODO: confirm that this is correct
+ assert j['status'] == 'ZERO_RESULTS', jdump(j)
def test_api_comment(self):
settings.OWS_LIMIT_COMMENT = -1 # turn off limit for testing
View
2  setup.py
@@ -22,7 +22,7 @@ def read(fname):
author = 'Justine Tunney',
author_email = 'jtunney@lobstertech.com',
license = 'GNU AGPL v3 or later',
- install_requires = ['Django==1.3.1', 'python-memcached>=1.40', 'pytz',
+ install_requires = ['Django>=1.4', 'python-memcached>=1.40', 'pytz',
'markdown', 'twilio', 'django-debug-toolbar',
'recaptcha-client', 'gunicorn', 'django-rosetta',
'django-imagekit', 'south', 'Whoosh', 'redis',
Please sign in to comment.
Something went wrong with that request. Please try again.