1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00

[django 1.8] WIP

This commit is contained in:
zhengxie 2015-10-12 18:36:24 +08:00
parent cf1d719ecf
commit 68efe49481
24 changed files with 73 additions and 28 deletions

View File

@ -2,8 +2,8 @@ python-dateutil
chardet
six
Pillow>=2.6.1,<3.0.0
Django>=1.5.8,<1.6
Djblets==0.6.14
Django==1.8.5
Djblets==0.8.22
django-compressor==1.4
django-statici18n==1.1.2
git+git://github.com/haiwen/django-constance.git@bde7f7cdfd0ed1631a6817fd4cd76f37bf54fe35#egg=django-constance[database]

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url, include
from .views import *
from .views_misc import ServerInfoView

View File

@ -50,8 +50,8 @@ class AnonymousUser(object):
is_staff = False
is_active = False
is_superuser = False
_groups = EmptyManager()
_user_permissions = EmptyManager()
_groups = EmptyManager(object)
_user_permissions = EmptyManager(object)
def __init__(self):
pass

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
urlpatterns = patterns('seahub.avatar.views',
url('^add/$', 'add', name='avatar_add'),

View File

@ -13,7 +13,7 @@ from constance import config
from seahub.settings import SEAFILE_VERSION, SITE_TITLE, SITE_NAME, \
MAX_FILE_NAME, BRANDING_CSS, LOGO_PATH, LOGO_WIDTH, LOGO_HEIGHT,\
SHOW_REPO_DOWNLOAD_BUTTON
SHOW_REPO_DOWNLOAD_BUTTON, SITE_ROOT
try:
from seahub.settings import SEACLOUD_MODE
@ -86,4 +86,5 @@ def base(request):
'grps': grps,
'multi_tenancy': MULTI_TENANCY,
'search_repo_id': search_repo_id,
'SITE_ROOT': SITE_ROOT,
}

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url, include
from django.views.generic import TemplateView
from django.conf import settings

View File

@ -70,6 +70,7 @@ class Contact(models.Model):
class ContactAddForm(ModelForm):
class Meta:
model = Contact
fields = "__all__"
def clean(self):
if not 'contact_email' in self.cleaned_data:
@ -80,6 +81,7 @@ class ContactAddForm(ModelForm):
class ContactEditForm(ModelForm):
class Meta:
model = Contact
fields = "__all__"
def __init__(self, *args, **kwargs):
super(ContactEditForm, self).__init__(*args, **kwargs)

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
from views import *

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
from views import group_info, group_members, group_member_operations, group_add_admin, \
group_manage, msg_reply, msg_reply_new, group_recommend, \

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url, include
from django.views.generic import TemplateView
urlpatterns = patterns(

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
from django.views.generic.base import RedirectView
from views import message_list, message_send ,user_msg_list ,msg_count

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
urlpatterns = patterns('seahub.notifications.views',
# url(r'^$', 'notification_list', name='notification_list'),

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
from views import *

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns('seahub.profile.views',
# url(r'^list_user/$', 'list_userids', name="list_userids"),

View File

@ -121,7 +121,7 @@ MIDDLEWARE_CLASSES = (
)
SITE_ROOT_URLCONF = 'seahub.urls'
ROOT_URLCONF = 'djblets.util.rooturl'
ROOT_URLCONF = 'seahub.utils.rooturl'
SITE_ROOT = '/'
# Python dotted path to the WSGI application used by Django's runserver.
@ -176,7 +176,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'djblets.util.context_processors.siteRoot',
# 'djblets.util.context_processors.siteRoot',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'seahub.base.context_processors.base',

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
from views import *

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url, include
from views import thumbnail_create, thumbnail_get, share_link_thumbnail_get, \
share_link_thumbnail_create

View File

@ -1,5 +1,5 @@
from django.conf.urls.defaults import *
from django.conf import settings
from django.conf.urls import patterns, url, include
# from django.views.generic.simple import direct_to_template
from django.views.generic import TemplateView

41
seahub/utils/rooturl.py Normal file
View File

@ -0,0 +1,41 @@
#
# rooturl.py -- URL patterns for rooted sites.
#
# Copyright (c) 2007-2009 Christian Hammond
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
from django.conf import settings
from django.conf.urls import patterns, include
from django.core.exceptions import ImproperlyConfigured
# Ensures that we can run nose on this without needing to set SITE_ROOT.
# Also serves to let people know if they set one variable without the other.
if hasattr(settings, "SITE_ROOT"):
if not hasattr(settings, "SITE_ROOT_URLCONF"):
raise ImproperlyConfigured("SITE_ROOT_URLCONF must be set when "
"using SITE_ROOT")
urlpatterns = patterns('',
(r'^%s' % settings.SITE_ROOT[1:], include(settings.SITE_ROOT_URLCONF)),
)

View File

@ -24,7 +24,7 @@ consult a specific backend's documentation for details.
"""
from django.conf import settings
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
from seahub.auth import views as auth_views

View File

@ -6,7 +6,7 @@ import re
from django.conf import settings
from django.db import models
from django.db import transaction
# from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
@ -91,14 +91,14 @@ class RegistrationManager(models.Manager):
return self.create_email_user(username, email, password, site,
send_email, is_active=False)
create_inactive_user = transaction.commit_on_success(create_inactive_user)
# create_inactive_user = transaction.commit_on_success(create_inactive_user)
def create_active_user(self, username, email, password,
site, send_email=True):
return self.create_email_user(username, email, password, site,
send_email, is_active=True)
create_inactive_user = transaction.commit_on_success(create_inactive_user)
# create_inactive_user = transaction.commit_on_success(create_inactive_user)
def create_profile(self, user):
"""

View File

@ -4,11 +4,11 @@ Parsers are used to parse the content of incoming HTTP requests.
They give us a generic way of being able to handle various media types
on the request, such as form content or json encoded data.
"""
import json
from django.http import QueryDict
from django.http.multipartparser import MultiPartParser as DjangoMultiPartParser
from django.http.multipartparser import MultiPartParserError
from django.utils import simplejson as json
from rest_framework.compat import yaml, ETParseError
from rest_framework.exceptions import ParseError
from xml.etree import ElementTree as ET

View File

@ -8,10 +8,10 @@ REST framework also provides an HTML renderer the renders the browsable API.
"""
import copy
import string
import json
from django import forms
from django.http.multipartparser import parse_header
from django.template import RequestContext, loader, Template
from django.utils import simplejson as json
from rest_framework.compat import yaml
from rest_framework.exceptions import ConfigurationError
from rest_framework.settings import api_settings

View File

@ -4,7 +4,8 @@ Helper classes for parsers.
import datetime
import decimal
import types
from django.utils import simplejson as json
import json
from django.utils.datastructures import SortedDict
from rest_framework.compat import timezone
from rest_framework.serializers import DictWithMetadata, SortedDictWithMetadata