mirror of
https://github.com/haiwen/seahub.git
synced 2025-05-07 23:48:23 +00:00
Change code structure to fit django 1.5
This commit is contained in:
parent
d3a9bf1254
commit
08b3e1115a
logs
manage.pyseahub
__init__.py
api2
avatar
__init__.pyadmin.pyforms.pyi18n.sh.template
locale
management
media/avatar/img
models.pysettings.pysignals.pytemplates
avatar
notification
templatetags
testdata
tests.pyurls.pyutil.pyviews.pybase
__init__.pyaccounts.pycontext_processors.pydecorators.pyi18n.sh.template
cconvert.pylocale
management
middleware.pymixins.pymodels.pyregistration_urls.pytemplatetags
tests.pyutils.pyviews.pycontacts
__init__.pyhandlers.pyi18n.sh.template
convert-utf-8.txtforms.pylocale
models.pysettings.pysignals.pytemplates/contacts
urls.pyviews.pyfts
group
__init__.pydecorators.pyerror_msg.py
fixtures
forms.pyhandlers.pyi18n.sh.templatelocale
models.pysettings.pysignals.pytemplates/group
4
logs/.gitignore
vendored
4
logs/.gitignore
vendored
@ -1,4 +0,0 @@
|
|||||||
# Ignore everything in this directory
|
|
||||||
*
|
|
||||||
# Except this file
|
|
||||||
!.gitignore
|
|
15
manage.py
15
manage.py
@ -1,11 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from django.core.management import execute_manager
|
import os
|
||||||
try:
|
import sys
|
||||||
import settings # Assumed to be in the same directory.
|
|
||||||
except ImportError:
|
|
||||||
import sys
|
|
||||||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
execute_manager(settings)
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seahub.settings")
|
||||||
|
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
|
execute_from_command_line(sys.argv)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from rest_framework.authentication import BaseAuthentication
|
from rest_framework.authentication import BaseAuthentication
|
||||||
|
|
||||||
from models import Token
|
from models import Token
|
||||||
from base.accounts import User
|
from seahub.base.accounts import User
|
||||||
|
|
||||||
class TokenAuthentication(BaseAuthentication):
|
class TokenAuthentication(BaseAuthentication):
|
||||||
"""
|
"""
|
@ -1,9 +1,9 @@
|
|||||||
import uuid
|
import uuid
|
||||||
import hmac
|
import hmac
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
from base.accounts import User
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
from seahub.base.accounts import User
|
||||||
|
|
||||||
class Token(models.Model):
|
class Token(models.Model):
|
||||||
"""
|
"""
|
@ -20,8 +20,8 @@ from models import Token
|
|||||||
from authentication import TokenAuthentication
|
from authentication import TokenAuthentication
|
||||||
from permissions import IsRepoWritable, IsRepoAccessible, IsRepoOwner
|
from permissions import IsRepoWritable, IsRepoAccessible, IsRepoOwner
|
||||||
from serializers import AuthTokenSerializer
|
from serializers import AuthTokenSerializer
|
||||||
from base.accounts import User
|
from seahub.base.accounts import User
|
||||||
from share.models import FileShare
|
from seahub.share.models import FileShare
|
||||||
from seahub.views import access_to_repo, validate_owner
|
from seahub.views import access_to_repo, validate_owner
|
||||||
from seahub.utils import gen_file_get_url, gen_token, gen_file_upload_url, \
|
from seahub.utils import gen_file_get_url, gen_token, gen_file_upload_url, \
|
||||||
check_filename_with_rename, get_starred_files, get_ccnetapplet_root, \
|
check_filename_with_rename, get_starred_files, get_ccnetapplet_root, \
|
@ -6,8 +6,8 @@ from django.utils.safestring import mark_safe
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.template.defaultfilters import filesizeformat
|
from django.template.defaultfilters import filesizeformat
|
||||||
|
|
||||||
from avatar.models import Avatar
|
from seahub.avatar.models import Avatar
|
||||||
from avatar.settings import (AVATAR_MAX_AVATARS_PER_USER, AVATAR_MAX_SIZE,
|
from seahub.avatar.settings import (AVATAR_MAX_AVATARS_PER_USER, AVATAR_MAX_SIZE,
|
||||||
AVATAR_ALLOWED_FILE_EXTS, AVATAR_DEFAULT_SIZE)
|
AVATAR_ALLOWED_FILE_EXTS, AVATAR_DEFAULT_SIZE)
|
||||||
|
|
||||||
|
|
Before ![]() (image error) Size: 3.4 KiB After ![]() (image error) Size: 3.4 KiB ![]() ![]() |
@ -21,8 +21,8 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import Image
|
import Image
|
||||||
|
|
||||||
from avatar.util import invalidate_cache
|
from seahub.avatar.util import invalidate_cache
|
||||||
from avatar.settings import (AVATAR_STORAGE_DIR, AVATAR_RESIZE_METHOD,
|
from seahub.avatar.settings import (AVATAR_STORAGE_DIR, AVATAR_RESIZE_METHOD,
|
||||||
AVATAR_MAX_AVATARS_PER_USER, AVATAR_THUMB_FORMAT,
|
AVATAR_MAX_AVATARS_PER_USER, AVATAR_THUMB_FORMAT,
|
||||||
AVATAR_HASH_USERDIRNAMES, AVATAR_HASH_FILENAMES,
|
AVATAR_HASH_USERDIRNAMES, AVATAR_HASH_FILENAMES,
|
||||||
AVATAR_THUMB_QUALITY, AUTO_GENERATE_AVATAR_SIZES,
|
AVATAR_THUMB_QUALITY, AUTO_GENERATE_AVATAR_SIZES,
|
@ -8,9 +8,9 @@ from django.core.urlresolvers import reverse
|
|||||||
from seahub.base.accounts import User
|
from seahub.base.accounts import User
|
||||||
from seahub.views import is_registered_user
|
from seahub.views import is_registered_user
|
||||||
|
|
||||||
from avatar.settings import (AVATAR_GRAVATAR_BACKUP, AVATAR_GRAVATAR_DEFAULT,
|
from seahub.avatar.settings import (AVATAR_GRAVATAR_BACKUP, AVATAR_GRAVATAR_DEFAULT,
|
||||||
AVATAR_DEFAULT_SIZE)
|
AVATAR_DEFAULT_SIZE)
|
||||||
from avatar.util import get_primary_avatar, get_default_avatar_url, \
|
from seahub.avatar.util import get_primary_avatar, get_default_avatar_url, \
|
||||||
cache_result, get_default_avatar_non_registered_url
|
cache_result, get_default_avatar_non_registered_url
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
@ -2,10 +2,10 @@ from django.conf import settings
|
|||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django import template
|
from django import template
|
||||||
|
|
||||||
from avatar.settings import (GROUP_AVATAR_DEFAULT_SIZE, AVATAR_CACHE_TIMEOUT,
|
from seahub.avatar.settings import (GROUP_AVATAR_DEFAULT_SIZE, AVATAR_CACHE_TIMEOUT,
|
||||||
GROUP_AVATAR_DEFAULT_URL)
|
GROUP_AVATAR_DEFAULT_URL)
|
||||||
from avatar.models import GroupAvatar
|
from seahub.avatar.models import GroupAvatar
|
||||||
from avatar.util import get_grp_cache_key
|
from seahub.avatar.util import get_grp_cache_key
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
Before (image error) Size: 136 KiB After (image error) Size: 136 KiB |
Before (image error) Size: 136 KiB After (image error) Size: 136 KiB |
Before ![]() (image error) Size: 136 KiB After ![]() (image error) Size: 136 KiB ![]() ![]() |
Before ![]() (image error) Size: 1.1 MiB After ![]() (image error) Size: 1.1 MiB ![]() ![]() |
@ -1,6 +1,6 @@
|
|||||||
from django.conf.urls.defaults import patterns, url
|
from django.conf.urls.defaults import patterns, url
|
||||||
|
|
||||||
urlpatterns = patterns('avatar.views',
|
urlpatterns = patterns('seahub.avatar.views',
|
||||||
url('^add/$', 'add', name='avatar_add'),
|
url('^add/$', 'add', name='avatar_add'),
|
||||||
url('^group/(?P<gid>\d+)/add/$', 'group_add', name='avatar_group_add'),
|
url('^group/(?P<gid>\d+)/add/$', 'group_add', name='avatar_group_add'),
|
||||||
# url('^change/$', 'change', name='avatar_change'),
|
# url('^change/$', 'change', name='avatar_change'),
|
@ -3,7 +3,7 @@ from django.core.cache import cache
|
|||||||
|
|
||||||
from seahub.base.accounts import User
|
from seahub.base.accounts import User
|
||||||
|
|
||||||
from avatar.settings import (AVATAR_DEFAULT_URL, AVATAR_CACHE_TIMEOUT,
|
from seahub.avatar.settings import (AVATAR_DEFAULT_URL, AVATAR_CACHE_TIMEOUT,
|
||||||
AUTO_GENERATE_AVATAR_SIZES, AVATAR_DEFAULT_SIZE,
|
AUTO_GENERATE_AVATAR_SIZES, AVATAR_DEFAULT_SIZE,
|
||||||
AVATAR_DEFAULT_NON_REGISTERED_URL,
|
AVATAR_DEFAULT_NON_REGISTERED_URL,
|
||||||
AUTO_GENERATE_GROUP_AVATAR_SIZES)
|
AUTO_GENERATE_GROUP_AVATAR_SIZES)
|
@ -7,12 +7,12 @@ from django.utils.translation import ugettext as _
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
|
||||||
from avatar.forms import PrimaryAvatarForm, DeleteAvatarForm, UploadAvatarForm,\
|
from seahub.avatar.forms import PrimaryAvatarForm, DeleteAvatarForm, UploadAvatarForm,\
|
||||||
GroupAvatarForm
|
GroupAvatarForm
|
||||||
from avatar.models import Avatar, GroupAvatar
|
from seahub.avatar.models import Avatar, GroupAvatar
|
||||||
from avatar.settings import AVATAR_MAX_AVATARS_PER_USER, AVATAR_DEFAULT_SIZE
|
from seahub.avatar.settings import AVATAR_MAX_AVATARS_PER_USER, AVATAR_DEFAULT_SIZE
|
||||||
from avatar.signals import avatar_updated
|
from seahub.avatar.signals import avatar_updated
|
||||||
from avatar.util import get_primary_avatar, get_default_avatar_url, \
|
from seahub.avatar.util import get_primary_avatar, get_default_avatar_url, \
|
||||||
invalidate_cache, invalidate_group_cache
|
invalidate_cache, invalidate_group_cache
|
||||||
from seahub.utils import render_error, render_permission_error, \
|
from seahub.utils import render_error, render_permission_error, \
|
||||||
check_and_get_org_by_group
|
check_and_get_org_by_group
|
@ -4,16 +4,16 @@ from django.utils.encoding import smart_str
|
|||||||
from django.utils.hashcompat import md5_constructor, sha_constructor
|
from django.utils.hashcompat import md5_constructor, sha_constructor
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from django.contrib.sites.models import RequestSite
|
from django.contrib.sites.models import RequestSite
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
|
|
||||||
from auth.models import get_hexdigest, check_password
|
from auth.models import get_hexdigest, check_password
|
||||||
from auth import authenticate, login
|
from auth import authenticate, login
|
||||||
from registration import signals
|
from registration import signals
|
||||||
#from registration.forms import RegistrationForm
|
#from registration.forms import RegistrationForm
|
||||||
from seaserv import ccnet_threaded_rpc, unset_repo_passwd, is_passwd_set
|
from seaserv import ccnet_threaded_rpc, unset_repo_passwd, is_passwd_set
|
||||||
|
|
||||||
from profile.models import Profile
|
from seahub.profile.models import Profile
|
||||||
|
|
||||||
|
|
||||||
UNUSABLE_PASSWORD = '!' # This will never be a valid hash
|
UNUSABLE_PASSWORD = '!' # This will never be a valid hash
|
@ -6,15 +6,15 @@ and returns a dictionary to add to the context.
|
|||||||
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
||||||
RequestContext.
|
RequestContext.
|
||||||
"""
|
"""
|
||||||
from settings import SEAFILE_VERSION, SITE_TITLE, SITE_NAME, SITE_BASE, \
|
from seahub.settings import SEAFILE_VERSION, SITE_TITLE, SITE_NAME, SITE_BASE, \
|
||||||
ENABLE_SIGNUP, MAX_FILE_NAME, BRANDING_CSS, LOGO_PATH, LOGO_URL
|
ENABLE_SIGNUP, MAX_FILE_NAME, BRANDING_CSS, LOGO_PATH, LOGO_URL
|
||||||
try:
|
try:
|
||||||
from settings import BUSINESS_MODE
|
from seahub.settings import BUSINESS_MODE
|
||||||
except ImportError:
|
except ImportError:
|
||||||
BUSINESS_MODE = False
|
BUSINESS_MODE = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from settings import ENABLE_FILE_SEARCH
|
from seahub.settings import ENABLE_FILE_SEARCH
|
||||||
except ImportError:
|
except ImportError:
|
||||||
ENABLE_FILE_SEARCH = False
|
ENABLE_FILE_SEARCH = False
|
||||||
|
|
@ -6,11 +6,11 @@ from django.dispatch import receiver
|
|||||||
|
|
||||||
from seaserv import get_emailusers
|
from seaserv import get_emailusers
|
||||||
|
|
||||||
from shortcuts import get_first_object_or_none
|
from seahub.shortcuts import get_first_object_or_none
|
||||||
from base.templatetags.seahub_tags import at_pattern
|
from seahub.base.templatetags.seahub_tags import at_pattern
|
||||||
from group.models import GroupMessage
|
from seahub.group.models import GroupMessage
|
||||||
from notifications.models import UserNotification
|
from seahub.notifications.models import UserNotification
|
||||||
from profile.models import Profile
|
from seahub.profile.models import Profile
|
||||||
|
|
||||||
class UuidObjidMap(models.Model):
|
class UuidObjidMap(models.Model):
|
||||||
"""
|
"""
|
@ -1,5 +1,6 @@
|
|||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
from django.views.generic.simple import direct_to_template
|
# from django.views.generic.simple import direct_to_template
|
||||||
|
from django.views.generic import TemplateView
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from registration.views import activate
|
from registration.views import activate
|
||||||
@ -16,8 +17,7 @@ if settings.ACTIVATE_AFTER_REGISTRATION == True:
|
|||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^activate/complete/$',
|
url(r'^activate/complete/$',
|
||||||
direct_to_template,
|
TemplateView.as_view(template_name='registration/activation_complete.html'),
|
||||||
{ 'template': 'registration/activation_complete.html' },
|
|
||||||
name='registration_activation_complete'),
|
name='registration_activation_complete'),
|
||||||
# Activation keys get matched by \w+ instead of the more specific
|
# Activation keys get matched by \w+ instead of the more specific
|
||||||
# [a-fA-F0-9]{40} because a bad activation key should still get to the view;
|
# [a-fA-F0-9]{40} because a bad activation key should still get to the view;
|
||||||
@ -31,10 +31,10 @@ urlpatterns = patterns('',
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from settings import CLOUD_MODE
|
from seahub.settings import CLOUD_MODE
|
||||||
except ImportError:
|
except ImportError:
|
||||||
CLOUD_MODE = False
|
CLOUD_MODE = False
|
||||||
from settings import ENABLE_SIGNUP
|
from seahub.settings import ENABLE_SIGNUP
|
||||||
|
|
||||||
if CLOUD_MODE or ENABLE_SIGNUP:
|
if CLOUD_MODE or ENABLE_SIGNUP:
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns('',
|
||||||
@ -42,14 +42,14 @@ if CLOUD_MODE or ENABLE_SIGNUP:
|
|||||||
register,
|
register,
|
||||||
reg_dict,
|
reg_dict,
|
||||||
name='registration_register'),
|
name='registration_register'),
|
||||||
url(r'^register/complete/$',
|
# Refer http://stackoverflow.com/questions/11005733/moving-from-direct-to-template-to-new-templateview-in-django to migrate direct_to_template with extra_context.
|
||||||
direct_to_template,
|
# url(r'^register/complete/$',
|
||||||
{ 'template': 'registration/registration_complete.html',
|
# TemplateView.as_view(
|
||||||
'extra_context': { 'send_mail': settings.REGISTRATION_SEND_MAIL } },
|
# template_name='registration/registration_complete.html',
|
||||||
name='registration_complete'),
|
# extra_context={ 'send_mail': settings.REGISTRATION_SEND_MAIL } ),
|
||||||
|
# name='registration_complete'),
|
||||||
url(r'^register/closed/$',
|
url(r'^register/closed/$',
|
||||||
direct_to_template,
|
TemplateView.as_view(template_name='registration/registration_closed.html'),
|
||||||
{ 'template': 'registration/registration_closed.html' },
|
|
||||||
name='registration_disallowed'),
|
name='registration_disallowed'),
|
||||||
)
|
)
|
||||||
|
|
@ -12,13 +12,13 @@ from django.utils.translation import ugettext as _
|
|||||||
from django.utils.translation import ungettext
|
from django.utils.translation import ungettext
|
||||||
from django.utils.translation import pgettext
|
from django.utils.translation import pgettext
|
||||||
|
|
||||||
from profile.models import Profile
|
from seahub.base.accounts import User
|
||||||
from profile.settings import NICKNAME_CACHE_TIMEOUT, NICKNAME_CACHE_PREFIX, \
|
from seahub.profile.models import Profile
|
||||||
|
from seahub.profile.settings import NICKNAME_CACHE_TIMEOUT, NICKNAME_CACHE_PREFIX, \
|
||||||
EMAIL_ID_CACHE_TIMEOUT, EMAIL_ID_CACHE_PREFIX
|
EMAIL_ID_CACHE_TIMEOUT, EMAIL_ID_CACHE_PREFIX
|
||||||
from seahub.cconvert import CConvert
|
from seahub.cconvert import CConvert
|
||||||
from seahub.po import TRANSLATION_MAP
|
from seahub.po import TRANSLATION_MAP
|
||||||
from seahub.shortcuts import get_first_object_or_none
|
from seahub.shortcuts import get_first_object_or_none
|
||||||
from base.accounts import User
|
|
||||||
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
@ -80,7 +80,7 @@ $('#contact-edit-form').submit(function() {
|
|||||||
var form = $(this),
|
var form = $(this),
|
||||||
form_id = $(this).attr('id');
|
form_id = $(this).attr('id');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{% url contact_edit %}',
|
url: '{% url 'contact_edit' %}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
cache: 'false',
|
cache: 'false',
|
||||||
@ -133,7 +133,7 @@ $('#contact-add-form').submit(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{% url contact_add_post %}',
|
url: '{% url 'contact_add_post' %}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
cache: 'false',
|
cache: 'false',
|
@ -12,8 +12,7 @@ from django.contrib import messages
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from models import Contact, ContactAddForm, ContactEditForm
|
from models import Contact, ContactAddForm, ContactEditForm
|
||||||
from utils import render_error
|
from seahub.utils import render_error
|
||||||
|
|
||||||
from seaserv import ccnet_rpc, ccnet_threaded_rpc
|
from seaserv import ccnet_rpc, ccnet_threaded_rpc
|
||||||
from seahub.views import is_registered_user
|
from seahub.views import is_registered_user
|
||||||
from seahub.settings import SITE_ROOT
|
from seahub.settings import SITE_ROOT
|
@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from seaserv import ccnet_rpc, ccnet_threaded_rpc, seafserv_threaded_rpc, \
|
from seaserv import ccnet_rpc, ccnet_threaded_rpc, seafserv_threaded_rpc, \
|
||||||
is_valid_filename
|
is_valid_filename
|
||||||
|
|
||||||
from seahub.base.accounts import User
|
from base.accounts import User
|
||||||
from pysearpc import SearpcError
|
from pysearpc import SearpcError
|
||||||
|
|
||||||
import settings
|
import settings
|
@ -1,6 +1,6 @@
|
|||||||
from signals import grpmsg_added
|
from signals import grpmsg_added
|
||||||
from models import GroupMessage
|
from models import GroupMessage
|
||||||
from notifications.models import UserNotification
|
from seahub.notifications.models import UserNotification
|
||||||
|
|
||||||
from seaserv import get_group_members
|
from seaserv import get_group_members
|
||||||
|
|
@ -7,9 +7,9 @@ from django.dispatch import receiver
|
|||||||
|
|
||||||
from seaserv import get_group_members
|
from seaserv import get_group_members
|
||||||
|
|
||||||
from shortcuts import get_first_object_or_none
|
from seahub.shortcuts import get_first_object_or_none
|
||||||
from notifications.models import UserNotification
|
from seahub.notifications.models import UserNotification
|
||||||
from profile.models import Profile
|
from seahub.profile.models import Profile
|
||||||
|
|
||||||
class GroupMessage(models.Model):
|
class GroupMessage(models.Model):
|
||||||
group_id = models.IntegerField(db_index=True)
|
group_id = models.IntegerField(db_index=True)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user