From f63768095d3fb0b82ce1621d5f3621b3a78ef5f5 Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Thu, 4 Nov 2010 12:23:55 +0000 Subject: [PATCH] Revert "web: avoid importing or accessing modules using "web.*"" This reverts commit d50bb7a66f1ab53b925ca312763a3ae49d32e039. Conflicts: web/settings.py Do imports from pyi2phosts.* --- web/extsources/models.py | 2 +- web/jump/urls.py | 2 +- web/jump/views.py | 6 +++--- web/lib/validation.py | 2 +- web/other/views.py | 2 +- web/postkey/urls.py | 2 +- web/postkey/views.py | 10 +++++----- web/settings.py | 2 +- web/urls.py | 8 +++++--- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/web/extsources/models.py b/web/extsources/models.py index 0ac8c56..5c54351 100644 --- a/web/extsources/models.py +++ b/web/extsources/models.py @@ -1,6 +1,6 @@ from django.db import models -from lib.validation import validate_i2purl +from pyi2phosts.lib.validation import validate_i2purl class ExternalSource(models.Model): name = models.CharField(max_length=128, unique=True) diff --git a/web/jump/urls.py b/web/jump/urls.py index fb9c5dc..76a825c 100644 --- a/web/jump/urls.py +++ b/web/jump/urls.py @@ -1,6 +1,6 @@ from django.conf.urls.defaults import * -urlpatterns = patterns('jump.views', +urlpatterns = patterns('pyi2phosts.jump.views', (r'^([^$/]+)', 'jumper'), ) diff --git a/web/jump/views.py b/web/jump/views.py index eceee32..8951418 100644 --- a/web/jump/views.py +++ b/web/jump/views.py @@ -3,9 +3,9 @@ import re from django.shortcuts import render_to_response from django.core.exceptions import ValidationError -from postkey.models import i2phost -from lib.validation import validate_hostname -import settings +from pyi2phosts.postkey.models import i2phost +from pyi2phosts.lib.validation import validate_hostname +from web import settings def jumper(request, host): """Actually do jumps.""" diff --git a/web/lib/validation.py b/web/lib/validation.py index ff5bb4c..2747bd7 100644 --- a/web/lib/validation.py +++ b/web/lib/validation.py @@ -4,7 +4,7 @@ import re from django.core.exceptions import ValidationError -from postkey.models import i2phost +from pyi2phosts.postkey.models import i2phost def validate_hostname(data): diff --git a/web/other/views.py b/web/other/views.py index fa3409f..538b82f 100644 --- a/web/other/views.py +++ b/web/other/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render_to_response -import settings +from web import settings def index(request): return render_to_response('index.html', { diff --git a/web/postkey/urls.py b/web/postkey/urls.py index 719becc..47443cd 100644 --- a/web/postkey/urls.py +++ b/web/postkey/urls.py @@ -1,6 +1,6 @@ from django.conf.urls.defaults import * -urlpatterns = patterns('postkey.views', +urlpatterns = patterns('pyi2phosts.postkey.views', (r'^$', 'addkey'), (r'^success/', 'success'), ) diff --git a/web/postkey/views.py b/web/postkey/views.py index f4ed5fd..f1ae53d 100644 --- a/web/postkey/views.py +++ b/web/postkey/views.py @@ -5,11 +5,11 @@ from django.forms import ModelForm from django.shortcuts import render_to_response from django.template import RequestContext -import settings -from postkey.models import i2phost -from lib.utils import get_logger -from lib.validation import validate_hostname -from lib.validation import validate_b64hash +from web import settings +from pyi2phosts.postkey.models import i2phost +from pyi2phosts.lib.utils import get_logger +from pyi2phosts.lib.validation import validate_hostname +from pyi2phosts.lib.validation import validate_b64hash class AddForm(ModelForm): """ diff --git a/web/settings.py b/web/settings.py index b040388..24a757e 100644 --- a/web/settings.py +++ b/web/settings.py @@ -78,7 +78,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', ) -ROOT_URLCONF = 'urls' +ROOT_URLCONF = 'pyi2phosts.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". diff --git a/web/urls.py b/web/urls.py index fbfeafb..86cc5ea 100644 --- a/web/urls.py +++ b/web/urls.py @@ -4,12 +4,14 @@ from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() -from other.views import * +from pyi2phosts.other.views import * urlpatterns = patterns('', url(r'^$', index, name='index'), - (r'^postkey/', include('postkey.urls')), - (r'^jump/', include('jump.urls')), + (r'^postkey/', include('pyi2phosts.postkey.urls')), + (r'^jump/', include('pyi2phosts.jump.urls')), + # Example: + # (r'^pyi2phosts.', include('pyi2phosts.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: