Enable absolute imports.

See PEP 328[1] for details. This feature was introduced in Python 2.5 and
will become mandatory in Python 3.

[1]: http://www.python.org/dev/peps/pep-0328

(imported from commit 7444eeba8a08d5f91b94c7921848f2274979bd76)
This commit is contained in:
Luke Faraone
2013-04-23 09:51:17 -07:00
parent b1dd0ae09c
commit 71a91197fa
68 changed files with 137 additions and 5 deletions

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
def add_settings(request): def add_settings(request):

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
from django.http import QueryDict from django.http import QueryDict

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.views.debug import SafeExceptionReporterFilter from django.views.debug import SafeExceptionReporterFilter
from django.http import build_request_repr from django.http import build_request_repr

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django import forms from django import forms
from django.core import validators from django.core import validators
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import sys import sys
import logging import logging
import traceback import traceback

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from django.contrib.sessions.models import Session from django.contrib.sessions.models import Session
from zephyr.lib.context_managers import lockfile from zephyr.lib.context_managers import lockfile

View File

@@ -1,5 +1,7 @@
from __future__ import absolute_import
import hashlib import hashlib
from utils import make_safe_digest from zephyr.lib.utils import make_safe_digest
def gravatar_hash(email): def gravatar_hash(email):
"""Compute the Gravatar hash for an email address.""" """Compute the Gravatar hash for an email address."""

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from zephyr.lib.initial_password import initial_password, initial_api_key from zephyr.lib.initial_password import initial_password, initial_api_key

View File

@@ -1,11 +1,11 @@
from __future__ import absolute_import
from functools import wraps from functools import wraps
from django.core.cache import cache as djcache from django.core.cache import cache as djcache
from django.core.cache import get_cache from django.core.cache import get_cache
from utils import make_safe_digest from zephyr.lib.utils import statsd, statsd_key, make_safe_digest
from zephyr.lib.utils import statsd, statsd_key
def cache_with_key(keyfunc, cache_name=None, timeout=None): def cache_with_key(keyfunc, cache_name=None, timeout=None):
"""Decorator which applies Django caching to a function. """Decorator which applies Django caching to a function.

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
# This file needs to be different from cache.py because cache.py # This file needs to be different from cache.py because cache.py
# cannot import anything from zephyr.models or we'd have an import # cannot import anything from zephyr.models or we'd have an import
# loop # loop

View File

@@ -2,6 +2,8 @@
Context managers, i.e. things you can use with the 'with' statement. Context managers, i.e. things you can use with the 'with' statement.
""" """
from __future__ import absolute_import
import fcntl import fcntl
from os import path from os import path
from contextlib import contextmanager from contextlib import contextmanager

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import UserManager from django.contrib.auth.models import UserManager
from django.utils import timezone from django.utils import timezone

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import code import code
import traceback import traceback
import signal import signal

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from collections import deque from collections import deque
import os import os

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
import hashlib import hashlib

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from hashlib import sha1 from hashlib import sha1
from os import path from os import path

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import os import os
import pty import pty
import sys import sys

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
def last_n(n, query_set): def last_n(n, query_set):
"""Get the last n results from a Django QuerySet, in a semi-efficient way. """Get the last n results from a Django QuerySet, in a semi-efficient way.
Returns a list.""" Returns a list."""

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
import pika import pika
import logging import logging

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.http import HttpResponse, HttpResponseNotAllowed from django.http import HttpResponse, HttpResponseNotAllowed
import simplejson import simplejson

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
import os import os
import logging import logging

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import time import time
import ctypes import ctypes
import threading import threading

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime import datetime
import calendar import calendar
from django.utils.timezone import utc from django.utils.timezone import utc

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import logging import logging
import time import time
from tornado import ioloop from tornado import ioloop

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import re import re
import bisect import bisect
import simplejson import simplejson

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import
import hashlib import hashlib
from time import sleep, time from time import sleep, time
from django.conf import settings from django.conf import settings

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from confirmation.models import Confirmation from confirmation.models import Confirmation

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserProfile, Recipient, Message, get_client from zephyr.models import Realm, UserProfile, Recipient, Message, get_client

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.lib.actions import do_change_user_email from zephyr.lib.actions import do_change_user_email

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import NoArgsCommand from django.core.management.base import NoArgsCommand
from zephyr.models import clear_database from zephyr.models import clear_database

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import StreamColor, Subscription from zephyr.models import StreamColor, Subscription

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.lib.actions import do_create_realm from zephyr.lib.actions import do_create_realm

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import sys import sys
from optparse import make_option from optparse import make_option

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import Subscription, Recipient, Message, Stream, \ from zephyr.models import Subscription, Recipient, Message, Stream, \
get_user_profile_by_email get_user_profile_by_email

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import UserProfile, get_user_profile_by_email from zephyr.models import UserProfile, get_user_profile_by_email

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserProfile, Message, UserMessage, \ from zephyr.models import Realm, UserProfile, Message, UserMessage, \

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserActivity, get_client, \ from zephyr.models import Realm, UserActivity, get_client, \

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import os import os
import sys import sys
import select import select

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.retention_policy import get_UserMessages_to_expunge from zephyr.retention_policy import get_UserMessages_to_expunge
from zephyr.models import Message from zephyr.models import Message

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import os import os
import sys import sys
import datetime import datetime

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.lib.cache_helpers import fill_memcached_cache, cache_fillers from zephyr.lib.cache_helpers import fill_memcached_cache, cache_fillers

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils.timezone import utc, now from django.utils.timezone import utc, now

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.lib.initial_password import initial_password, initial_api_key from zephyr.lib.initial_password import initial_password, initial_api_key

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
import simplejson import simplejson

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime import datetime
import pytz import pytz

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import Subscription, Recipient, get_user_profile_by_email from zephyr.models import Subscription, Recipient, get_user_profile_by_email

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
settings.RUNNING_INSIDE_TORNADO = True settings.RUNNING_INSIDE_TORNADO = True
# We must call zephyr.lib.tornado_ioloop_logging.instrument_tornado_ioloop # We must call zephyr.lib.tornado_ioloop_logging.instrument_tornado_ioloop

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from zephyr.models import get_user_profile_by_email, get_prereg_user_by_email from zephyr.models import get_user_profile_by_email, get_prereg_user_by_email

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.conf import settings from django.conf import settings

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
import logging import logging
import sys import sys

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
import logging import logging

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import simplejson import simplejson
from postmonkey import PostMonkey from postmonkey import PostMonkey
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from optparse import make_option from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime import datetime
import pytz import pytz

View File

@@ -1,5 +1,7 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from decorator import RequestVariableMissingError, RequestVariableConversionError from zephyr.decorator import RequestVariableMissingError, RequestVariableConversionError
from zephyr.lib.response import json_error from zephyr.lib.response import json_error
from django.db import connection from django.db import connection
from zephyr.lib.utils import statsd from zephyr.lib.utils import statsd

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.db import models from django.db import models
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser, UserManager from django.contrib.auth.models import AbstractBaseUser, UserManager

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
# Defer importing until later to avoid circular imports # Defer importing until later to avoid circular imports
def openid_failure_handler(request, message, status=403, template_name=None, exception=None): def openid_failure_handler(request, message, status=403, template_name=None, exception=None):

View File

@@ -9,6 +9,7 @@ rather than iterating through messages one by one.
The code in this module does not actually remove anything; it just identifies The code in this module does not actually remove anything; it just identifies
which items should be kept or removed. which items should be kept or removed.
""" """
from __future__ import absolute_import
import operator import operator

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from django.test.simple import DjangoTestSuiteRunner from django.test.simple import DjangoTestSuiteRunner

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from zephyr.models import Message, UserProfile, UserMessage, \ from zephyr.models import Message, UserProfile, UserMessage, \
Recipient, Stream, get_stream Recipient, Stream, get_stream

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from zephyr.models import UserActivity from zephyr.models import UserActivity

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from django.contrib.auth import authenticate, login from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required