Change code structure to fit django 1.5
4
logs/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
15
manage.py
@ -1,11 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
from django.core.management import execute_manager
|
||||
try:
|
||||
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)
|
||||
import os
|
||||
import sys
|
||||
|
||||
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 models import Token
|
||||
from base.accounts import User
|
||||
from seahub.base.accounts import User
|
||||
|
||||
class TokenAuthentication(BaseAuthentication):
|
||||
"""
|
@ -1,9 +1,9 @@
|
||||
import uuid
|
||||
import hmac
|
||||
from hashlib import sha1
|
||||
from base.accounts import User
|
||||
from django.db import models
|
||||
|
||||
from seahub.base.accounts import User
|
||||
|
||||
class Token(models.Model):
|
||||
"""
|
@ -20,8 +20,8 @@ from models import Token
|
||||
from authentication import TokenAuthentication
|
||||
from permissions import IsRepoWritable, IsRepoAccessible, IsRepoOwner
|
||||
from serializers import AuthTokenSerializer
|
||||
from base.accounts import User
|
||||
from share.models import FileShare
|
||||
from seahub.base.accounts import User
|
||||
from seahub.share.models import FileShare
|
||||
from seahub.views import access_to_repo, validate_owner
|
||||
from seahub.utils import gen_file_get_url, gen_token, gen_file_upload_url, \
|
||||
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.template.defaultfilters import filesizeformat
|
||||
|
||||
from avatar.models import Avatar
|
||||
from avatar.settings import (AVATAR_MAX_AVATARS_PER_USER, AVATAR_MAX_SIZE,
|
||||
from seahub.avatar.models import Avatar
|
||||
from seahub.avatar.settings import (AVATAR_MAX_AVATARS_PER_USER, AVATAR_MAX_SIZE,
|
||||
AVATAR_ALLOWED_FILE_EXTS, AVATAR_DEFAULT_SIZE)
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
@ -21,8 +21,8 @@ try:
|
||||
except ImportError:
|
||||
import Image
|
||||
|
||||
from avatar.util import invalidate_cache
|
||||
from avatar.settings import (AVATAR_STORAGE_DIR, AVATAR_RESIZE_METHOD,
|
||||
from seahub.avatar.util import invalidate_cache
|
||||
from seahub.avatar.settings import (AVATAR_STORAGE_DIR, AVATAR_RESIZE_METHOD,
|
||||
AVATAR_MAX_AVATARS_PER_USER, AVATAR_THUMB_FORMAT,
|
||||
AVATAR_HASH_USERDIRNAMES, AVATAR_HASH_FILENAMES,
|
||||
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.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)
|
||||
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
|
||||
|
||||
register = template.Library()
|
@ -2,10 +2,10 @@ from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
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)
|
||||
from avatar.models import GroupAvatar
|
||||
from avatar.util import get_grp_cache_key
|
||||
from seahub.avatar.models import GroupAvatar
|
||||
from seahub.avatar.util import get_grp_cache_key
|
||||
|
||||
register = template.Library()
|
||||
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@ -1,6 +1,6 @@
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('avatar.views',
|
||||
urlpatterns = patterns('seahub.avatar.views',
|
||||
url('^add/$', 'add', name='avatar_add'),
|
||||
url('^group/(?P<gid>\d+)/add/$', 'group_add', name='avatar_group_add'),
|
||||
# url('^change/$', 'change', name='avatar_change'),
|
@ -3,7 +3,7 @@ from django.core.cache import cache
|
||||
|
||||
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,
|
||||
AVATAR_DEFAULT_NON_REGISTERED_URL,
|
||||
AUTO_GENERATE_GROUP_AVATAR_SIZES)
|
@ -7,12 +7,12 @@ from django.utils.translation import ugettext as _
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
|
||||
from avatar.forms import PrimaryAvatarForm, DeleteAvatarForm, UploadAvatarForm,\
|
||||
from seahub.avatar.forms import PrimaryAvatarForm, DeleteAvatarForm, UploadAvatarForm,\
|
||||
GroupAvatarForm
|
||||
from avatar.models import Avatar, GroupAvatar
|
||||
from avatar.settings import AVATAR_MAX_AVATARS_PER_USER, AVATAR_DEFAULT_SIZE
|
||||
from avatar.signals import avatar_updated
|
||||
from avatar.util import get_primary_avatar, get_default_avatar_url, \
|
||||
from seahub.avatar.models import Avatar, GroupAvatar
|
||||
from seahub.avatar.settings import AVATAR_MAX_AVATARS_PER_USER, AVATAR_DEFAULT_SIZE
|
||||
from seahub.avatar.signals import avatar_updated
|
||||
from seahub.avatar.util import get_primary_avatar, get_default_avatar_url, \
|
||||
invalidate_cache, invalidate_group_cache
|
||||
from seahub.utils import render_error, render_permission_error, \
|
||||
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.translation import ugettext_lazy as _
|
||||
from django.conf import settings
|
||||
|
||||
from django.contrib.sites.models import RequestSite
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
from auth.models import get_hexdigest, check_password
|
||||
from auth import authenticate, login
|
||||
from registration import signals
|
||||
#from registration.forms import RegistrationForm
|
||||
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
|
@ -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
|
||||
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
|
||||
try:
|
||||
from settings import BUSINESS_MODE
|
||||
from seahub.settings import BUSINESS_MODE
|
||||
except ImportError:
|
||||
BUSINESS_MODE = False
|
||||
|
||||
try:
|
||||
from settings import ENABLE_FILE_SEARCH
|
||||
from seahub.settings import ENABLE_FILE_SEARCH
|
||||
except ImportError:
|
||||
ENABLE_FILE_SEARCH = False
|
||||
|
@ -6,11 +6,11 @@ from django.dispatch import receiver
|
||||
|
||||
from seaserv import get_emailusers
|
||||
|
||||
from shortcuts import get_first_object_or_none
|
||||
from base.templatetags.seahub_tags import at_pattern
|
||||
from group.models import GroupMessage
|
||||
from notifications.models import UserNotification
|
||||
from profile.models import Profile
|
||||
from seahub.shortcuts import get_first_object_or_none
|
||||
from seahub.base.templatetags.seahub_tags import at_pattern
|
||||
from seahub.group.models import GroupMessage
|
||||
from seahub.notifications.models import UserNotification
|
||||
from seahub.profile.models import Profile
|
||||
|
||||
class UuidObjidMap(models.Model):
|
||||
"""
|
@ -1,5 +1,6 @@
|
||||
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 registration.views import activate
|
||||
@ -16,8 +17,7 @@ if settings.ACTIVATE_AFTER_REGISTRATION == True:
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^activate/complete/$',
|
||||
direct_to_template,
|
||||
{ 'template': 'registration/activation_complete.html' },
|
||||
TemplateView.as_view(template_name='registration/activation_complete.html'),
|
||||
name='registration_activation_complete'),
|
||||
# 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;
|
||||
@ -31,10 +31,10 @@ urlpatterns = patterns('',
|
||||
)
|
||||
|
||||
try:
|
||||
from settings import CLOUD_MODE
|
||||
from seahub.settings import CLOUD_MODE
|
||||
except ImportError:
|
||||
CLOUD_MODE = False
|
||||
from settings import ENABLE_SIGNUP
|
||||
from seahub.settings import ENABLE_SIGNUP
|
||||
|
||||
if CLOUD_MODE or ENABLE_SIGNUP:
|
||||
urlpatterns += patterns('',
|
||||
@ -42,14 +42,14 @@ if CLOUD_MODE or ENABLE_SIGNUP:
|
||||
register,
|
||||
reg_dict,
|
||||
name='registration_register'),
|
||||
url(r'^register/complete/$',
|
||||
direct_to_template,
|
||||
{ 'template': 'registration/registration_complete.html',
|
||||
'extra_context': { 'send_mail': settings.REGISTRATION_SEND_MAIL } },
|
||||
name='registration_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.
|
||||
# url(r'^register/complete/$',
|
||||
# TemplateView.as_view(
|
||||
# template_name='registration/registration_complete.html',
|
||||
# extra_context={ 'send_mail': settings.REGISTRATION_SEND_MAIL } ),
|
||||
# name='registration_complete'),
|
||||
url(r'^register/closed/$',
|
||||
direct_to_template,
|
||||
{ 'template': 'registration/registration_closed.html' },
|
||||
TemplateView.as_view(template_name='registration/registration_closed.html'),
|
||||
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 pgettext
|
||||
|
||||
from profile.models import Profile
|
||||
from profile.settings import NICKNAME_CACHE_TIMEOUT, NICKNAME_CACHE_PREFIX, \
|
||||
from seahub.base.accounts import User
|
||||
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
|
||||
from seahub.cconvert import CConvert
|
||||
from seahub.po import TRANSLATION_MAP
|
||||
from seahub.shortcuts import get_first_object_or_none
|
||||
from base.accounts import User
|
||||
|
||||
|
||||
register = template.Library()
|
@ -80,7 +80,7 @@ $('#contact-edit-form').submit(function() {
|
||||
var form = $(this),
|
||||
form_id = $(this).attr('id');
|
||||
$.ajax({
|
||||
url: '{% url contact_edit %}',
|
||||
url: '{% url 'contact_edit' %}',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
||||
@ -133,7 +133,7 @@ $('#contact-add-form').submit(function() {
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '{% url contact_add_post %}',
|
||||
url: '{% url 'contact_add_post' %}',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
@ -12,8 +12,7 @@ from django.contrib import messages
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
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 seahub.views import is_registered_user
|
||||
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, \
|
||||
is_valid_filename
|
||||
|
||||
from seahub.base.accounts import User
|
||||
from base.accounts import User
|
||||
from pysearpc import SearpcError
|
||||
|
||||
import settings
|
@ -1,6 +1,6 @@
|
||||
from signals import grpmsg_added
|
||||
from models import GroupMessage
|
||||
from notifications.models import UserNotification
|
||||
from seahub.notifications.models import UserNotification
|
||||
|
||||
from seaserv import get_group_members
|
||||
|
@ -7,9 +7,9 @@ from django.dispatch import receiver
|
||||
|
||||
from seaserv import get_group_members
|
||||
|
||||
from shortcuts import get_first_object_or_none
|
||||
from notifications.models import UserNotification
|
||||
from profile.models import Profile
|
||||
from seahub.shortcuts import get_first_object_or_none
|
||||
from seahub.notifications.models import UserNotification
|
||||
from seahub.profile.models import Profile
|
||||
|
||||
class GroupMessage(models.Model):
|
||||
group_id = models.IntegerField(db_index=True)
|