Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Django 1.8 support (without admin module) #20

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions nexus/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ class NexusModule(object):
# list of active sites within process
_globals = {}

def __init__(self, site, category=None, name=None, app_name=None):
def __init__(self, site, category=None, name=None):
self.category = category
self.site = site
self.name = name
self.app_name = app_name

# Set up default logging for this module
if not self.logger_name:
Expand Down Expand Up @@ -118,22 +117,20 @@ def get_urls(self):
return patterns('')

def urls(self):
if self.app_name and self.name:
return self.get_urls(), self.app_name, self.name
if self.name:
return self.get_urls(), self.name, self.name
return self.get_urls()

urls = property(urls)


def get_trail(self, request):
return [
(self.get_title(), self.get_home_url(request)),
]

def get_home_url(self, request):
if self.home_url:
if self.app_name:
home_url_name = '%s:%s' % (self.app_name, self.home_url)
if self.name:
home_url_name = '%s:%s' % (self.name, self.home_url)
else:
home_url_name = self.home_url

Expand Down
167 changes: 0 additions & 167 deletions nexus/nexus_modules.py

This file was deleted.

28 changes: 13 additions & 15 deletions nexus/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ def process_view(self, request, callback, callback_args, callback_kwargs):


class NexusSite(object):
def __init__(self, name=None, app_name='nexus'):
def __init__(self, name=None):
self._registry = {}
self._categories = SortedDict()
if name is None:
self.name = 'nexus'
else:
self.name = name
self.app_name = app_name

def register_category(self, category, label, index=None):
if index:
Expand All @@ -76,7 +75,7 @@ def register(self, module, namespace=None, category=None):
if not namespace:
namespace = module.get_namespace()
if namespace:
module.app_name = module.name = namespace
module.name = namespace
self._registry[namespace] = (module, category)
return module

Expand All @@ -86,25 +85,24 @@ def unregister(self, namespace):

def get_urls(self):
try:
from django.conf.urls import patterns, url, include
from django.conf.urls import url, include
except ImportError: # Django<=1.4
from django.conf.urls.defaults import patterns, url, include
from django.conf.urls.defaults import url, include

base_urls = patterns('',
base_urls = [
url(r'^media/(?P<module>[^/]+)/(?P<path>.+)$', self.media, name='media'),

url(r'^$', self.as_view(self.dashboard), name='index'),
url(r'^login/$', self.login, name='login'),
url(r'^logout/$', self.as_view(self.logout), name='logout'),
), self.app_name, self.name
url(r'^logout/$', self.as_view(self.logout), name='logout')
]

urlpatterns = patterns('',
url(r'^', include(base_urls)),
)
urlpatterns = [
url(r'^', include(base_urls, namespace=self.name, app_name=self.name))
]
for namespace, module in self.get_modules():
urlpatterns += patterns('',
url(r'^%s/' % namespace, include(module.urls)),
)
urlpatterns += [
url(r'^%s/' % namespace, include(module.urls))
]

return urlpatterns

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def run(self, *args, **kwargs):

setup(
name='nexus',
version='0.3.1',
version='0.3.1.sm0',
author='Disqus',
author_email='[email protected]',
url='https://github.com/disqus/nexus',
Expand Down