mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 15:38:15 +00:00
Modify notification email sending
This commit is contained in:
122
settings.py
122
settings.py
@@ -120,24 +120,6 @@ AUTHENTICATION_BACKENDS = (
|
|||||||
|
|
||||||
ACCOUNT_ACTIVATION_DAYS = 7
|
ACCOUNT_ACTIVATION_DAYS = 7
|
||||||
|
|
||||||
# Set to True when user will be activaed after registration,
|
|
||||||
# and no email sending
|
|
||||||
ACTIVATE_AFTER_REGISTRATION = True
|
|
||||||
|
|
||||||
# In order to use email sending,
|
|
||||||
# ACTIVATE_AFTER_REGISTRATION MUST set to False
|
|
||||||
REGISTRATION_SEND_MAIL = False
|
|
||||||
|
|
||||||
# seafile httpserver address and port
|
|
||||||
HTTP_SERVER_ROOT = "http://localhost:8082"
|
|
||||||
|
|
||||||
# ccnet-applet address and port, used in repo download
|
|
||||||
CCNET_APPLET_ROOT = "http://localhost:13420"
|
|
||||||
|
|
||||||
SEAFILE_VERSION = '0.9.2'
|
|
||||||
|
|
||||||
SEAHUB_TITLE = 'SeaHub'
|
|
||||||
|
|
||||||
# Add supported file extensions and file icon name.
|
# Add supported file extensions and file icon name.
|
||||||
# Icons will show in repo page.
|
# Icons will show in repo page.
|
||||||
FILEEXT_ICON_MAP = {
|
FILEEXT_ICON_MAP = {
|
||||||
@@ -162,14 +144,8 @@ FILEEXT_ICON_MAP = {
|
|||||||
'default' : 'file-icon-24.png',
|
'default' : 'file-icon-24.png',
|
||||||
}
|
}
|
||||||
|
|
||||||
USE_SUBDOMAIN = False
|
|
||||||
#SITE_SUBDOMAIN = 'cloud'
|
|
||||||
#SITE_BASE_NAME = 'seafile.com.cn'
|
|
||||||
#SESSION_COOKIE_DOMAIN = '.' + SITE_BASE_NAME
|
|
||||||
|
|
||||||
# account type is `personal` or `business`
|
|
||||||
ACCOUNT_TYPE = 'personal'
|
|
||||||
|
|
||||||
|
# File preview
|
||||||
FILE_PREVIEW_MAX_SIZE = 10 * 1024 * 1024
|
FILE_PREVIEW_MAX_SIZE = 10 * 1024 * 1024
|
||||||
|
|
||||||
PREVIEW_FILEEXT = {
|
PREVIEW_FILEEXT = {
|
||||||
@@ -177,6 +153,66 @@ PREVIEW_FILEEXT = {
|
|||||||
'Image': ('ai', 'bmp', 'eps', 'gif', 'ind', 'jpeg', 'jpg', 'png', 'ps', 'psd', 'svg', 'tif', 'tiff'),
|
'Image': ('ai', 'bmp', 'eps', 'gif', 'ind', 'jpeg', 'jpg', 'png', 'ps', 'psd', 'svg', 'tif', 'tiff'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Avatar
|
||||||
|
AVATAR_STORAGE_DIR = 'avatars'
|
||||||
|
AVATAR_GRAVATAR_BACKUP = False
|
||||||
|
AVATAR_DEFAULT_URL = '/avatars/default.jpg'
|
||||||
|
AUTO_GENERATE_AVATAR_SIZES = (80, 60, 48, 16)
|
||||||
|
AVATAR_MAX_AVATARS_PER_USER = 1
|
||||||
|
AVATAR_CACHE_TIMEOUT = 0
|
||||||
|
|
||||||
|
# Info-bar notification cache
|
||||||
|
NOTIFICATION_CACHE_TIMEOUT = 0
|
||||||
|
|
||||||
|
|
||||||
|
# File upload
|
||||||
|
FILE_UPLOAD_MAX_MEMORY_SIZE = 0
|
||||||
|
|
||||||
|
FILE_UPLOAD_TEMP_DIR = "/tmp/seafile-upload"
|
||||||
|
|
||||||
|
if not os.access(FILE_UPLOAD_TEMP_DIR, os.F_OK):
|
||||||
|
os.mkdir(FILE_UPLOAD_TEMP_DIR)
|
||||||
|
|
||||||
|
FILE_UPLOAD_HANDLERS = (
|
||||||
|
"seahub.utils.UploadProgressCachedHandler",
|
||||||
|
"django.core.files.uploadhandler.MemoryFileUploadHandler",
|
||||||
|
"django.core.files.uploadhandler.TemporaryFileUploadHandler",
|
||||||
|
)
|
||||||
|
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||||
|
'LOCATION': '/tmp/seahub_cache',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MAX_UPLOAD_FILE_SIZE = 1024 * 1024 * 1024 # 1GB
|
||||||
|
MAX_UPLOAD_FILE_NAME_LEN = 256
|
||||||
|
|
||||||
|
# Base url and name used in email sending
|
||||||
|
SITE_BASE = 'http://gonggeng.org/'
|
||||||
|
SITE_NAME = 'gonggeng'
|
||||||
|
|
||||||
|
# Set to True when user will be activaed after registration,
|
||||||
|
# and no email sending
|
||||||
|
ACTIVATE_AFTER_REGISTRATION = True
|
||||||
|
|
||||||
|
# In order to use email sending,
|
||||||
|
# ACTIVATE_AFTER_REGISTRATION MUST set to False
|
||||||
|
REGISTRATION_SEND_MAIL = False
|
||||||
|
|
||||||
|
# Seafile httpserver address and port
|
||||||
|
HTTP_SERVER_ROOT = "http://localhost:8082"
|
||||||
|
|
||||||
|
# Seafile-applet address and port, used in repo download
|
||||||
|
CCNET_APPLET_ROOT = "http://localhost:13420"
|
||||||
|
|
||||||
|
SEAFILE_VERSION = '0.9.2'
|
||||||
|
SEAHUB_TITLE = 'SeaHub'
|
||||||
|
|
||||||
|
USE_SUBDOMAIN = False
|
||||||
|
ACCOUNT_TYPE = 'personal'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import local_settings
|
import local_settings
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -197,40 +233,4 @@ else:
|
|||||||
elif re.search('^[A-Z]', attr):
|
elif re.search('^[A-Z]', attr):
|
||||||
globals()[attr] = getattr(local_settings, attr)
|
globals()[attr] = getattr(local_settings, attr)
|
||||||
|
|
||||||
#avatar
|
|
||||||
AVATAR_STORAGE_DIR = 'avatars'
|
|
||||||
AVATAR_GRAVATAR_BACKUP = False
|
|
||||||
AVATAR_DEFAULT_URL = '/avatars/default.jpg'
|
|
||||||
AUTO_GENERATE_AVATAR_SIZES = (80, 60, 48, 16)
|
|
||||||
AVATAR_MAX_AVATARS_PER_USER = 1
|
|
||||||
AVATAR_CACHE_TIMEOUT = 0
|
|
||||||
|
|
||||||
#info-bar notification
|
|
||||||
NOTIFICATION_CACHE_TIMEOUT = 0
|
|
||||||
|
|
||||||
LOGIN_URL = SITE_ROOT + 'accounts/login'
|
LOGIN_URL = SITE_ROOT + 'accounts/login'
|
||||||
|
|
||||||
FILE_UPLOAD_MAX_MEMORY_SIZE = 0
|
|
||||||
|
|
||||||
FILE_UPLOAD_TEMP_DIR = "/tmp/seafile-upload"
|
|
||||||
|
|
||||||
if not os.access(FILE_UPLOAD_TEMP_DIR, os.F_OK):
|
|
||||||
os.mkdir(FILE_UPLOAD_TEMP_DIR)
|
|
||||||
|
|
||||||
FILE_UPLOAD_HANDLERS = (
|
|
||||||
"seahub.utils.UploadProgressCachedHandler",
|
|
||||||
"django.core.files.uploadhandler.MemoryFileUploadHandler",
|
|
||||||
"django.core.files.uploadhandler.TemporaryFileUploadHandler",
|
|
||||||
)
|
|
||||||
|
|
||||||
# profile
|
|
||||||
#AUTH_PROFILE_MODULE = "profile.UserProfile"
|
|
||||||
CACHES = {
|
|
||||||
'default': {
|
|
||||||
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
|
||||||
'LOCATION': '/tmp/seahub_cache',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MAX_UPLOAD_FILE_SIZE = 1024 * 1024 * 1024 # 1GB
|
|
||||||
MAX_UPLOAD_FILE_NAME_LEN = 256
|
|
||||||
|
@@ -15,12 +15,17 @@ ${msg_url}
|
|||||||
|
|
||||||
感谢使用我们的网站!
|
感谢使用我们的网站!
|
||||||
|
|
||||||
Seafile团队
|
${site_name}团队
|
||||||
'''
|
'''
|
||||||
|
|
||||||
today = datetime.now()
|
today = datetime.now()
|
||||||
subject = u'SeaCloud:新消息'
|
site_name = settings.SITE_NAME
|
||||||
url = 'http://localhost:8000/home/my/'
|
subject = u'%s:新消息' % site_name
|
||||||
|
|
||||||
|
site_base = settings.SITE_BASE
|
||||||
|
if site_base[-1] != '/':
|
||||||
|
site_base += '/'
|
||||||
|
url = site_base + 'home/my/'
|
||||||
|
|
||||||
notifications = UserNotification.objects.all()
|
notifications = UserNotification.objects.all()
|
||||||
|
|
||||||
@@ -39,7 +44,8 @@ for k in d.keys():
|
|||||||
cnt = d[k]
|
cnt = d[k]
|
||||||
|
|
||||||
template = string.Template(email_template)
|
template = string.Template(email_template)
|
||||||
content = template.substitute(username=to_user, cnt=cnt, msg_url=url)
|
content = template.substitute(username=to_user, cnt=cnt, msg_url=url, \
|
||||||
|
site_name=site_name)
|
||||||
send_mail(subject, content, settings.DEFAULT_FROM_EMAIL, [to_user], \
|
send_mail(subject, content, settings.DEFAULT_FROM_EMAIL, [to_user], \
|
||||||
fail_silently=False)
|
fail_silently=False)
|
||||||
|
|
Reference in New Issue
Block a user