mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-14 21:23:50 +00:00
Update locale
This commit is contained in:
parent
0d57b3f060
commit
af6d22503c
@ -5,17 +5,17 @@ from fabric.api import local, task
|
|||||||
from fabric.colors import red, green
|
from fabric.colors import red, green
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def make(default=True):
|
def make(default=True, lang='en'):
|
||||||
"""Update source language.
|
"""Update source language.
|
||||||
"""
|
"""
|
||||||
local('django-admin.py makemessages -l en -e py,html -i "thirdpart*" -i "docs*"')
|
local('django-admin.py makemessages -l %s -e py,html -i "thirdpart*" -i "docs*"' % lang)
|
||||||
|
|
||||||
# some version of makemessages will produce "%%" in the string, replace that
|
# some version of makemessages will produce "%%" in the string, replace that
|
||||||
# to "%".
|
# to "%".
|
||||||
_inplace_change('locale/en/LC_MESSAGES/django.po', '%%s', '%s')
|
_inplace_change('locale/%s/LC_MESSAGES/django.po' % lang, '%%s', '%s')
|
||||||
_inplace_change('locale/en/LC_MESSAGES/django.po', '%%(', '%(')
|
_inplace_change('locale/%s/LC_MESSAGES/django.po' % lang, '%%(', '%(')
|
||||||
|
|
||||||
local('django-admin.py makemessages -l en -d djangojs -i "thirdpart" -i "node_modules" -i "media" -i "static/scripts/dist" -i "static/scripts/lib" -i "tests" -i "tools" -i "tagging" -i "static/scripts/i18n" --verbosity 2')
|
local('django-admin.py makemessages -l %s -d djangojs -i "thirdpart" -i "node_modules" -i "media" -i "static/scripts/dist" -i "static/scripts/lib" -i "tests" -i "tools" -i "tagging" -i "static/scripts/i18n" --verbosity 2' % lang)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def push():
|
def push():
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2016-01-21 11:36+0800\n"
|
"POT-Creation-Date: 2016-03-21 11:17+0800\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -17,67 +17,48 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: static/scripts/common.js:161 static/scripts/common.js.c:251
|
#: static/scripts/app/models/dirent.js:113
|
||||||
#: static/scripts/app/views/details.js:94 static/scripts/app/views/dir.js:852
|
#: static/scripts/app/views/device.js:51 static/scripts/app/views/dir.js:476
|
||||||
#: static/scripts/app/views/dir.js.c:909
|
#: static/scripts/app/views/dir.js:543
|
||||||
#: static/scripts/app/views/dirent.js:281
|
#: static/scripts/app/views/fileupload.js:344
|
||||||
#: static/scripts/app/views/dirent.js:432
|
#: static/scripts/app/views/fileupload.js:358
|
||||||
#: static/scripts/app/views/dirent.js:458
|
#: static/scripts/app/views/fileupload.js:370
|
||||||
#: static/scripts/app/views/folder-perm-item.js:82
|
#: static/scripts/app/views/fileupload.js:382
|
||||||
#: static/scripts/app/views/folder-perm-item.js:124
|
msgid "Just now"
|
||||||
#: static/scripts/app/views/folder-perm.js:156
|
|
||||||
#: static/scripts/app/views/folder-perm.js:208
|
|
||||||
#: static/scripts/app/views/folder-share-item.js:79
|
|
||||||
#: static/scripts/app/views/folder-share-item.js:115
|
|
||||||
#: static/scripts/app/views/group-repo.js:64
|
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:123
|
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:165
|
|
||||||
#: static/scripts/app/views/repo.js:83 static/scripts/app/views/share.js:352
|
|
||||||
#: static/scripts/app/views/share.js:620 static/scripts/app/views/share.js:679
|
|
||||||
#: static/scripts/app/views/sub-lib.js:81
|
|
||||||
msgid "Failed. Please check the network."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/common.js:519
|
#: static/scripts/app/models/repo.js:32
|
||||||
msgid "Search users or enter emails"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/common.js:529
|
|
||||||
msgid "Please enter 1 or more character"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/common.js:530
|
|
||||||
msgid "No matches"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/common.js:531
|
|
||||||
msgid "Searching..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/common.js:532
|
|
||||||
msgid "Loading failed"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/models/repo.js:30
|
|
||||||
msgid "Name is required"
|
msgid "Name is required"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/models/repo.js:33 static/scripts/app/views/share.js:203
|
#: static/scripts/app/models/repo.js:35 static/scripts/app/views/share.js:197
|
||||||
msgid "Please enter password"
|
msgid "Please enter password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/models/repo.js:34 static/scripts/app/views/share.js:211
|
#: static/scripts/app/models/repo.js:36 static/scripts/app/views/share.js:205
|
||||||
msgid "Please enter the password again"
|
msgid "Please enter the password again"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/models/repo.js:36 static/scripts/app/views/share.js:207
|
#: static/scripts/app/models/repo.js:38 static/scripts/app/views/share.js:201
|
||||||
msgid "Password is too short"
|
msgid "Password is too short"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/models/repo.js:38 static/scripts/app/views/share.js:215
|
#: static/scripts/app/models/repo.js:40 static/scripts/app/views/share.js:209
|
||||||
msgid "Passwords don't match"
|
msgid "Passwords don't match"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/models/repo.js:53
|
||||||
|
msgid "Encrypted"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/models/repo.js:55
|
||||||
|
msgid "Read-Write"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/models/repo.js:57
|
||||||
|
msgid "Read-Only"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/details.js:47
|
#: static/scripts/app/views/details.js:47
|
||||||
msgid "New files"
|
msgid "New files"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -102,215 +83,344 @@ msgstr ""
|
|||||||
msgid "Deleted directories"
|
msgid "Deleted directories"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:46
|
#: static/scripts/app/views/details.js:94
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:130
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:156
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-rename.js:66
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:95
|
||||||
|
#: static/scripts/app/views/dialogs/repo-history-settings.js:81
|
||||||
|
#: static/scripts/app/views/dialogs/repo-history-settings.js:140
|
||||||
|
#: static/scripts/app/views/dir.js:1048 static/scripts/app/views/dir.js:1105
|
||||||
|
#: static/scripts/app/views/dirent.js:259
|
||||||
|
#: static/scripts/app/views/folder-perm-item.js:82
|
||||||
|
#: static/scripts/app/views/folder-perm-item.js:124
|
||||||
|
#: static/scripts/app/views/folder-perm.js:155
|
||||||
|
#: static/scripts/app/views/folder-perm.js:207
|
||||||
|
#: static/scripts/app/views/folder-share-item.js:79
|
||||||
|
#: static/scripts/app/views/folder-share-item.js:115
|
||||||
|
#: static/scripts/app/views/group-manage-member.js:79
|
||||||
|
#: static/scripts/app/views/group-manage-member.js:105
|
||||||
|
#: static/scripts/app/views/group-manage-members.js:180
|
||||||
|
#: static/scripts/app/views/group-repo.js:72
|
||||||
|
#: static/scripts/app/views/group-settings.js:158
|
||||||
|
#: static/scripts/app/views/group-settings.js:214
|
||||||
|
#: static/scripts/app/views/group-settings.js:254
|
||||||
|
#: static/scripts/app/views/group-settings.js:311
|
||||||
|
#: static/scripts/app/views/group-settings.js:351
|
||||||
|
#: static/scripts/app/views/group-settings.js:386
|
||||||
|
#: static/scripts/app/views/repo.js:109 static/scripts/app/views/repo.js:205
|
||||||
|
#: static/scripts/app/views/repo.js:280 static/scripts/app/views/share.js:346
|
||||||
|
#: static/scripts/app/views/share.js:624 static/scripts/app/views/share.js:702
|
||||||
|
#: static/scripts/common.js:302 static/scripts/common.js:391
|
||||||
|
msgid "Failed. Please check the network."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/device.js:96
|
||||||
|
msgid "Successfully unlink %(name)s."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:50
|
||||||
|
msgid "Move {placeholder} to:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:50
|
||||||
|
msgid "Copy {placeholder} to:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:89
|
||||||
|
msgid "Moving %(name)s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:89
|
||||||
|
msgid "Copying %(name)s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:105
|
||||||
|
msgid "Saving..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:119
|
||||||
|
msgid "Failed."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:119
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:147
|
||||||
|
#: static/scripts/app/views/dir.js:1096
|
||||||
|
msgid "Canceled."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:179
|
||||||
|
#: static/scripts/app/views/dir.js:894
|
||||||
|
msgid "Invalid destination path"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:199
|
||||||
|
msgid "Successfully moved %(name)s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-mvcp.js:202
|
||||||
|
msgid "Successfully copied %(name)s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-rename.js:27
|
||||||
|
msgid "Rename Folder"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/dirent-rename.js:27
|
||||||
|
msgid "Rename File"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:26
|
||||||
|
msgid "Change Password of Library {placeholder}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:50
|
||||||
|
msgid "Please enter the old password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:54
|
||||||
|
msgid "Please enter a new password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:58
|
||||||
|
msgid "New password is too short"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:62
|
||||||
|
msgid "Please enter the new password again"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:66
|
||||||
|
msgid "New passwords don't match"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-change-password.js:88
|
||||||
|
msgid "Successfully changed library password."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:73
|
||||||
|
msgid "{placeholder} Folder Permission"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:92
|
||||||
|
#: static/scripts/app/views/group-settings.js:179
|
||||||
|
#: static/scripts/app/views/repo.js:244
|
||||||
|
msgid "Search user or enter email and press Enter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:94
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:105
|
||||||
|
msgid "You can only select 1 item"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:103
|
||||||
|
msgid "Select a group"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:121
|
||||||
|
#: static/scripts/app/views/dialogs/repo-share-link-admin.js:76
|
||||||
|
#: static/scripts/app/views/group-manage-members.js:112
|
||||||
|
#: static/scripts/app/views/group-members.js:77
|
||||||
|
#: static/scripts/app/views/group.js:133 static/scripts/app/views/groups.js:71
|
||||||
|
#: static/scripts/app/views/myhome-repos.js:111
|
||||||
|
#: static/scripts/app/views/myhome-shared-repos.js:72
|
||||||
|
#: static/scripts/app/views/organization.js:115
|
||||||
|
msgid "Permission error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:126
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:245
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:292
|
||||||
|
#: static/scripts/app/views/dialogs/repo-share-link-admin.js:81
|
||||||
|
#: static/scripts/app/views/dir.js:361
|
||||||
|
#: static/scripts/app/views/group-manage-members.js:117
|
||||||
|
#: static/scripts/app/views/group-manage-members.js:146
|
||||||
|
#: static/scripts/app/views/group-members.js:82
|
||||||
|
#: static/scripts/app/views/group.js:103 static/scripts/app/views/group.js:138
|
||||||
|
#: static/scripts/app/views/groups.js:76
|
||||||
|
#: static/scripts/app/views/groups.js:120
|
||||||
|
#: static/scripts/app/views/myhome-repos.js:116
|
||||||
|
#: static/scripts/app/views/myhome-shared-repos.js:77
|
||||||
|
#: static/scripts/app/views/organization.js:120
|
||||||
|
#: static/scripts/app/views/repo-folder-perm.js:92
|
||||||
|
#: static/scripts/app/views/repo-folder-perm.js:132
|
||||||
|
#: static/scripts/app/views/repo-shared-link.js:84
|
||||||
|
msgid "Please check the network."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-folder-perm-admin.js:186
|
||||||
|
msgid "Please click and choose a directory."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-history-settings.js:35
|
||||||
|
msgid "{placeholder} History Setting"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-history-settings.js:133
|
||||||
|
msgid "Successfully set library history."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dialogs/repo-share-link-admin.js:50
|
||||||
|
msgid "{placeholder} Share Links"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/dir.js:71
|
||||||
#: static/scripts/app/views/starred-file.js:29
|
#: static/scripts/app/views/starred-file.js:29
|
||||||
msgid "Close (Esc)"
|
msgid "Close (Esc)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:47
|
#: static/scripts/app/views/dir.js:72
|
||||||
#: static/scripts/app/views/starred-file.js:30
|
#: static/scripts/app/views/starred-file.js:30
|
||||||
msgid "Loading..."
|
msgid "Loading..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:50
|
#: static/scripts/app/views/dir.js:75
|
||||||
#: static/scripts/app/views/starred-file.js:33
|
#: static/scripts/app/views/starred-file.js:33
|
||||||
msgid "Previous (Left arrow key)"
|
msgid "Previous (Left arrow key)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:51
|
#: static/scripts/app/views/dir.js:76
|
||||||
#: static/scripts/app/views/starred-file.js:34
|
#: static/scripts/app/views/starred-file.js:34
|
||||||
msgid "Next (Right arrow key)"
|
msgid "Next (Right arrow key)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:52
|
#: static/scripts/app/views/dir.js:77
|
||||||
#: static/scripts/app/views/starred-file.js:35
|
#: static/scripts/app/views/starred-file.js:35
|
||||||
msgid "%curr% of %total%"
|
msgid "%curr% of %total%"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:58
|
#: static/scripts/app/views/dir.js:80
|
||||||
#: static/scripts/app/views/starred-file.js:41
|
|
||||||
msgid "Open in New Tab"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:61
|
|
||||||
#: static/scripts/app/views/starred-file.js:44
|
#: static/scripts/app/views/starred-file.js:44
|
||||||
msgid "<a href=\"%url%\" target=\"_blank\">The image</a> could not be loaded."
|
msgid "<a href=\"%url%\" target=\"_blank\">The image</a> could not be loaded."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:148
|
#: static/scripts/app/views/dir.js:90 static/scripts/app/views/dir.js:102
|
||||||
#: static/scripts/app/views/group-side-nav.js:39
|
#: static/scripts/app/views/starred-file.js:41
|
||||||
#: static/scripts/app/views/group.js:112 static/scripts/app/views/groups.js:77
|
msgid "Open in New Tab"
|
||||||
#: static/scripts/app/views/groups.js:122
|
|
||||||
#: static/scripts/app/views/myhome-repos.js:93
|
|
||||||
#: static/scripts/app/views/myhome-shared-repos.js:79
|
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:78
|
|
||||||
#: static/scripts/app/views/organization.js:124
|
|
||||||
msgid "Please check the network."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:174
|
#: static/scripts/app/views/dir.js:296
|
||||||
msgid "Password is required."
|
msgid "Password is required."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:345 static/scripts/app/views/dir.js.c:402
|
#: static/scripts/app/views/dir.js:461 static/scripts/app/views/dir.js:518
|
||||||
msgid "It is required."
|
msgid "It is required."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:360 static/scripts/app/views/dir.js.c:427
|
#: static/scripts/app/views/dir.js:524
|
||||||
#: static/scripts/app/views/dirent.js:266
|
|
||||||
#: static/scripts/app/views/fileupload.js:344
|
|
||||||
#: static/scripts/app/views/fileupload.js:358
|
|
||||||
#: static/scripts/app/views/fileupload.js:370
|
|
||||||
#: static/scripts/app/views/fileupload.js:382
|
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:152
|
|
||||||
msgid "Just now"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:408
|
|
||||||
msgid "Only an extension there, please input a name."
|
msgid "Only an extension there, please input a name."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:566 static/scripts/app/views/dir.js.c:703
|
#: static/scripts/app/views/dir.js:760 static/scripts/app/views/dir.js:899
|
||||||
msgid "Processing..."
|
msgid "Processing..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:602
|
#: static/scripts/app/views/dir.js:796
|
||||||
msgid "Successfully deleted %(name)s."
|
msgid "Successfully deleted %(name)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:604
|
#: static/scripts/app/views/dir.js:798
|
||||||
msgid "Successfully deleted %(name)s and 1 other item."
|
msgid "Successfully deleted %(name)s and 1 other item."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:606
|
#: static/scripts/app/views/dir.js:800
|
||||||
msgid "Successfully deleted %(name)s and %(amount)s other items."
|
msgid "Successfully deleted %(name)s and %(amount)s other items."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:613
|
#: static/scripts/app/views/dir.js:807
|
||||||
msgid "Failed to delete %(name)s."
|
msgid "Failed to delete %(name)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:615
|
#: static/scripts/app/views/dir.js:809
|
||||||
msgid "Failed to delete %(name)s and 1 other item."
|
msgid "Failed to delete %(name)s and 1 other item."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:617
|
#: static/scripts/app/views/dir.js:811
|
||||||
msgid "Failed to delete %(name)s and %(amount)s other items."
|
msgid "Failed to delete %(name)s and %(amount)s other items."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:630
|
#: static/scripts/app/views/dir.js:824
|
||||||
msgid "Delete Items"
|
msgid "Delete Items"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:631
|
#: static/scripts/app/views/dir.js:825
|
||||||
msgid "Are you sure you want to delete these selected items?"
|
msgid "Are you sure you want to delete these selected items?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:645
|
#: static/scripts/app/views/dir.js:839
|
||||||
msgid "Move selected item(s) to:"
|
msgid "Move selected item(s) to:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:645
|
#: static/scripts/app/views/dir.js:839
|
||||||
msgid "Copy selected item(s) to:"
|
msgid "Copy selected item(s) to:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:698 static/scripts/app/views/dirent.js:357
|
#: static/scripts/app/views/dir.js:942
|
||||||
msgid "Invalid destination path"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:746
|
|
||||||
msgid "Successfully moved %(name)s."
|
msgid "Successfully moved %(name)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:748
|
#: static/scripts/app/views/dir.js:944
|
||||||
msgid "Successfully moved %(name)s and 1 other item."
|
msgid "Successfully moved %(name)s and 1 other item."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:750
|
#: static/scripts/app/views/dir.js:946
|
||||||
msgid "Successfully moved %(name)s and %(amount)s other items."
|
msgid "Successfully moved %(name)s and %(amount)s other items."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:754
|
#: static/scripts/app/views/dir.js:950
|
||||||
msgid "Successfully copied %(name)s."
|
msgid "Successfully copied %(name)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:756
|
#: static/scripts/app/views/dir.js:952
|
||||||
msgid "Successfully copied %(name)s and 1 other item."
|
msgid "Successfully copied %(name)s and 1 other item."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:758
|
#: static/scripts/app/views/dir.js:954
|
||||||
msgid "Successfully copied %(name)s and %(amount)s other items."
|
msgid "Successfully copied %(name)s and %(amount)s other items."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:770
|
#: static/scripts/app/views/dir.js:966
|
||||||
msgid "Internal error. Failed to move %(name)s and %(amount)s other item(s)."
|
msgid "Internal error. Failed to move %(name)s and %(amount)s other item(s)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:772
|
#: static/scripts/app/views/dir.js:968
|
||||||
msgid "Internal error. Failed to move %(name)s."
|
msgid "Internal error. Failed to move %(name)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:776
|
#: static/scripts/app/views/dir.js:972
|
||||||
msgid "Internal error. Failed to copy %(name)s and %(amount)s other item(s)."
|
msgid "Internal error. Failed to copy %(name)s and %(amount)s other item(s)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:778
|
#: static/scripts/app/views/dir.js:974
|
||||||
msgid "Internal error. Failed to copy %(name)s."
|
msgid "Internal error. Failed to copy %(name)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:818
|
#: static/scripts/app/views/dir.js:1014
|
||||||
msgid "Moving file %(index)s of %(total)s"
|
msgid "Moving file %(index)s of %(total)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:818
|
#: static/scripts/app/views/dir.js:1014
|
||||||
msgid "Copying file %(index)s of %(total)s"
|
msgid "Copying file %(index)s of %(total)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:840
|
#: static/scripts/app/views/dir.js:1036
|
||||||
msgid "Failed to move %(name)s"
|
msgid "Failed to move %(name)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:840
|
#: static/scripts/app/views/dir.js:1036
|
||||||
msgid "Failed to copy %(name)s"
|
msgid "Failed to copy %(name)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dir.js:900 static/scripts/app/views/dirent.js:421
|
#: static/scripts/app/views/dirent-grid.js:60
|
||||||
#: static/scripts/app/views/dirent.js:449
|
#: static/scripts/app/views/dirent.js:53
|
||||||
msgid "Canceled."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:49
|
|
||||||
msgid "locked by {placeholder}"
|
msgid "locked by {placeholder}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:200
|
#: static/scripts/app/views/dirent-grid.js:154
|
||||||
|
#: static/scripts/app/views/dirent.js:198
|
||||||
msgid "Successfully deleted %(name)s"
|
msgid "Successfully deleted %(name)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:310
|
|
||||||
msgid "Move {placeholder} to:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:310
|
|
||||||
msgid "Copy {placeholder} to:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:391
|
|
||||||
msgid "Moving %(name)s"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:391
|
|
||||||
msgid "Copying %(name)s"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:407
|
|
||||||
msgid "Saving..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/dirent.js:421
|
|
||||||
msgid "Failed."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/fileupload.js:10
|
#: static/scripts/app/views/fileupload.js:10
|
||||||
msgid "File is too big"
|
msgid "File is too big"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -336,11 +446,13 @@ msgid "Empty file upload result"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/fileupload.js:17
|
#: static/scripts/app/views/fileupload.js:17
|
||||||
#: static/scripts/app/views/group.js:109 static/scripts/app/views/groups.js:74
|
#: static/scripts/app/views/group-manage-members.js:114
|
||||||
#: static/scripts/app/views/myhome-repos.js:90
|
#: static/scripts/app/views/group-manage-members.js:178
|
||||||
#: static/scripts/app/views/myhome-shared-repos.js:76
|
#: static/scripts/app/views/group-members.js:79
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:75
|
#: static/scripts/app/views/group.js:135 static/scripts/app/views/groups.js:73
|
||||||
#: static/scripts/app/views/organization.js:121
|
#: static/scripts/app/views/myhome-repos.js:113
|
||||||
|
#: static/scripts/app/views/myhome-shared-repos.js:74
|
||||||
|
#: static/scripts/app/views/organization.js:117
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -396,12 +508,12 @@ msgstr ""
|
|||||||
msgid "File is locked"
|
msgid "File is locked"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/folder-perm.js:49
|
#: static/scripts/app/views/folder-perm.js:48
|
||||||
msgid "Set {placeholder}'s permission"
|
msgid "Set {placeholder}'s permission"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/folder-perm.js:101
|
#: static/scripts/app/views/folder-perm.js:100
|
||||||
#: static/scripts/app/views/share.js:525
|
#: static/scripts/app/views/share.js:519
|
||||||
msgid "Select groups"
|
msgid "Select groups"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -413,75 +525,96 @@ msgstr ""
|
|||||||
msgid "Delete failed"
|
msgid "Delete failed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/group-repo.js:56
|
#: static/scripts/app/views/group-manage-members.js:71
|
||||||
#: static/scripts/app/views/organization-repo.js:52
|
msgid "{placeholder} Members"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/group-repo.js:64
|
||||||
|
#: static/scripts/app/views/organization-repo.js:59
|
||||||
msgid "Successfully unshared {placeholder}"
|
msgid "Successfully unshared {placeholder}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/group.js:107 static/scripts/app/views/groups.js:72
|
#: static/scripts/app/views/group-settings.js:180
|
||||||
#: static/scripts/app/views/myhome-repos.js:88
|
#: static/scripts/app/views/repo.js:245
|
||||||
#: static/scripts/app/views/myhome-shared-repos.js:74
|
msgid "You cannot select any more choices"
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:73
|
|
||||||
#: static/scripts/app/views/organization.js:119
|
|
||||||
msgid "Permission error"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:115
|
#: static/scripts/app/views/group-settings.js:272
|
||||||
msgid "You don't have any library at present."
|
msgid "Please choose a CSV file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/myhome-sub-repos.js:134
|
#: static/scripts/app/views/group-settings.js:303
|
||||||
msgid "Please choose a directory"
|
msgid "Successfully imported."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/repo.js:48 static/scripts/app/views/sub-lib.js:46
|
#: static/scripts/app/views/group-settings.js:331
|
||||||
|
msgid "Dismiss Group"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/group-settings.js:332
|
||||||
|
msgid "Really want to dismiss this group?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/group-settings.js:365
|
||||||
|
msgid "Quit Group"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/group-settings.js:366
|
||||||
|
msgid "Are you sure you want to quit this group?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/repo.js:74
|
||||||
msgid "Really want to delete {lib_name}?"
|
msgid "Really want to delete {lib_name}?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/repo.js:73 static/scripts/app/views/sub-lib.js:71
|
#: static/scripts/app/views/repo.js:99
|
||||||
msgid "Delete succeeded."
|
msgid "Delete succeeded."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:63
|
#: static/scripts/app/views/repo.js:234
|
||||||
|
msgid "Transfer Library {library_name} To"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/repo.js:273
|
||||||
|
msgid "Successfully transferred the library."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/app/views/share.js:57
|
||||||
msgid "Share {placeholder}"
|
msgid "Share {placeholder}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:132
|
#: static/scripts/app/views/share.js:126
|
||||||
msgid "Expired"
|
msgid "Expired"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:160 static/scripts/app/views/share.js:176
|
#: static/scripts/app/views/share.js:154 static/scripts/app/views/share.js:170
|
||||||
msgid "Hide"
|
msgid "Hide"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:173
|
#: static/scripts/app/views/share.js:167
|
||||||
msgid "Show"
|
msgid "Show"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:228
|
#: static/scripts/app/views/share.js:222
|
||||||
msgid "Please enter days."
|
msgid "Please enter days."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:232
|
#: static/scripts/app/views/share.js:226
|
||||||
msgid "Please enter valid days"
|
msgid "Please enter valid days"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:319
|
#: static/scripts/app/views/share.js:313
|
||||||
msgid "Please input at least an email."
|
msgid "Please input at least an email."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:336
|
#: static/scripts/app/views/share.js:330
|
||||||
msgid "Successfully sent to {placeholder}"
|
msgid "Successfully sent to {placeholder}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:340
|
#: static/scripts/app/views/share.js:334
|
||||||
msgid "Failed to send to {placeholder}"
|
msgid "Failed to send to {placeholder}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: static/scripts/app/views/share.js:609
|
|
||||||
msgid "Failed to share to {placeholder}"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: static/scripts/app/views/shared-repo.js:26
|
#: static/scripts/app/views/shared-repo.js:26
|
||||||
msgid "Success"
|
msgid "Success"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -489,3 +622,23 @@ msgstr ""
|
|||||||
#: static/scripts/app/views/starred-file-item.js:45
|
#: static/scripts/app/views/starred-file-item.js:45
|
||||||
msgid "Successfully unstared {placeholder}"
|
msgid "Successfully unstared {placeholder}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/common.js:671
|
||||||
|
msgid "Search users or enter emails and press Enter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/common.js:679
|
||||||
|
msgid "Please enter 1 or more character"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/common.js:680
|
||||||
|
msgid "No matches"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/common.js:681
|
||||||
|
msgid "Searching..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: static/scripts/common.js:682
|
||||||
|
msgid "Loading failed"
|
||||||
|
msgstr ""
|
||||||
|
@ -132,7 +132,7 @@ class UploadLinks(APIView):
|
|||||||
|
|
||||||
password = request.data.get('password', None)
|
password = request.data.get('password', None)
|
||||||
if password and len(password) < config.SHARE_LINK_PASSWORD_MIN_LENGTH:
|
if password and len(password) < config.SHARE_LINK_PASSWORD_MIN_LENGTH:
|
||||||
error_msg = _('Password is too short.')
|
error_msg = _('Password is too short')
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
user_perm = check_folder_permission(request, repo_id, '/')
|
user_perm = check_folder_permission(request, repo_id, '/')
|
||||||
|
BIN
seahub/seahub2.db
Normal file
BIN
seahub/seahub2.db
Normal file
Binary file not shown.
@ -57,7 +57,7 @@ $('#add-inst-form').submit(function() {
|
|||||||
name = $.trim(form.find('[name="name"]').val());
|
name = $.trim(form.find('[name="name"]').val());
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
apply_form_error(form_id, "{% trans "Name cannot be blank" %}");
|
apply_form_error(form_id, "{% trans "Name can not be blank" %}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
{{ user.ctime|tsstr_sec }} / {% if user.last_login %}{{user.last_login|translate_seahub_time}} {% else %} -- {% endif %}
|
{{ user.ctime|tsstr_sec }} / {% if user.last_login %}{{user.last_login|translate_seahub_time}} {% else %} -- {% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" class="js-toggle-admin op vh" data-url="{% url 'sys_inst_toggle_admin' inst.pk user.email %}" data-target="{{ user.email }}">{% if user.inst_admin %}{% trans "Revoke InstAdmin" %}{% else %}{% trans "Set InstAdmin" %}{% endif %}</a>
|
<a href="#" class="js-toggle-admin op vh" data-url="{% url 'sys_inst_toggle_admin' inst.pk user.email %}" data-target="{{ user.email }}">{% if user.inst_admin %}{% trans "Revoke Admin" %}{% else %}{% trans "Set Admin" %}{% endif %}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -52,8 +52,8 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
addConfirmTo($('.js-toggle-admin'), {
|
addConfirmTo($('.js-toggle-admin'), {
|
||||||
'title':"{% trans "Toggle Admin" %}",
|
'title': "Toggle Admin",
|
||||||
'con':"{% trans "Sure ?" %}",
|
'con': "Sure ?",
|
||||||
'post': true
|
'post': true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ addConfirmTo($('.revoke-admin-btn'), {
|
|||||||
'post': true // post request
|
'post': true // post request
|
||||||
});
|
});
|
||||||
addConfirmTo($('.unset-trial'), {
|
addConfirmTo($('.unset-trial'), {
|
||||||
'title':"{% trans "Remove Trial" %}",
|
'title': "Remove Trial",
|
||||||
'con':"{% trans "Are you sure you want to remove trial for %s ?" %}",
|
'con':"Are you sure you want to remove trial for %s ?",
|
||||||
'post': true // post request
|
'post': true // post request
|
||||||
});
|
});
|
||||||
|
|
||||||
|
129
seahub/views/tests/__init__.py
Normal file
129
seahub/views/tests/__init__.py
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
"""
|
||||||
|
This file demonstrates writing tests using the unittest module. These will pass
|
||||||
|
when you run "manage.py test".
|
||||||
|
|
||||||
|
Replace this with more appropriate tests for your application.
|
||||||
|
"""
|
||||||
|
import factory
|
||||||
|
from mock import Mock, patch
|
||||||
|
|
||||||
|
from django.http import HttpRequest
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from seahub.base.accounts import User
|
||||||
|
from seahub.wiki.models import PersonalWiki
|
||||||
|
from seahub.views.wiki import personal_wiki
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
global repo_id, mock_content, mock_repo, mock_dirent, request
|
||||||
|
repo_id = '181150f2-3df0-4ab3-9ecd-1e1ec8e14def'
|
||||||
|
mock_content = 'fake content'
|
||||||
|
mock_repo = Mock()
|
||||||
|
mock_repo.id = repo_id
|
||||||
|
mock_dirent = Mock()
|
||||||
|
mock_dirent.obj_name = 'home.md'
|
||||||
|
|
||||||
|
request = FakeRequestFactory()
|
||||||
|
|
||||||
|
def render_to_response_echo(*args, **kwargs):
|
||||||
|
"""mocked render_to_response that just returns what was passed in,
|
||||||
|
also puts the template name into the results dict
|
||||||
|
"""
|
||||||
|
context = args[1]
|
||||||
|
context.update(dict(template_name=args[0]))
|
||||||
|
return context
|
||||||
|
patch('seahub.views.wiki.render_to_response',
|
||||||
|
render_to_response_echo).start()
|
||||||
|
|
||||||
|
class PersonalWikiTest(TestCase):
|
||||||
|
|
||||||
|
@patch('seahub.views.wiki.seafile_api.get_owned_repo_list')
|
||||||
|
def test_wiki_does_not_exist(self, mock_get_owned_repo_list):
|
||||||
|
res = personal_wiki(request)
|
||||||
|
|
||||||
|
self.assertFalse(res.get('wiki_exists'))
|
||||||
|
self.assertEqual('wiki/personal_wiki.html', res.get('template_name'))
|
||||||
|
|
||||||
|
@patch('seahub.wiki.utils.seaserv.get_repo')
|
||||||
|
@patch('seahub.wiki.utils.seaserv.get_commits')
|
||||||
|
@patch('seahub.views.wiki.seaserv.post_empty_file')
|
||||||
|
def test_wiki_page_missing(self, mock_post_empty_file,
|
||||||
|
mock_get_commits, mock_get_repo):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
# setup personal wiki
|
||||||
|
PersonalWiki.objects.create(username=request.user.username,
|
||||||
|
repo_id=repo_id)
|
||||||
|
|
||||||
|
mock_get_repo.return_value = mock_repo
|
||||||
|
mock_get_commits.return_value = [None]
|
||||||
|
|
||||||
|
mock_post_empty_file.return_value = True
|
||||||
|
res = personal_wiki(request)
|
||||||
|
self.assertEqual('/home/wiki/home/', res['Location'])
|
||||||
|
|
||||||
|
@patch('seahub.views.wiki.get_personal_wiki_page')
|
||||||
|
@patch('seahub.base.models.FileContributors.objects.get_file_contributors')
|
||||||
|
def test_wiki_found(self, mock_get_file_contributors,
|
||||||
|
mock_get_personal_wiki_page):
|
||||||
|
mock_get_personal_wiki_page.return_value = (mock_content,
|
||||||
|
mock_repo,
|
||||||
|
mock_dirent)
|
||||||
|
|
||||||
|
mock_get_file_contributors.return_value = ([request.user.username],
|
||||||
|
None, None)
|
||||||
|
|
||||||
|
res = personal_wiki(request)
|
||||||
|
self.assertEqual('fake content', res.get('content'))
|
||||||
|
self.assertEqual('fake content', res.get('index_content'))
|
||||||
|
self.assertEqual('home', res.get('page'))
|
||||||
|
self.assertEqual('wiki/personal_wiki.html', res.get('template_name'))
|
||||||
|
|
||||||
|
########## Helpler functions and classes
|
||||||
|
def FakeRequestFactory(*args, **kwargs):
|
||||||
|
''' FakeRequestFactory, FakeMessages and FakeRequestContext are good for
|
||||||
|
mocking out django views; they are MUCH faster than the Django test client.
|
||||||
|
'''
|
||||||
|
|
||||||
|
user = UserFactory()
|
||||||
|
if kwargs.get('authenticated'):
|
||||||
|
user.is_authenticated = lambda: True
|
||||||
|
|
||||||
|
request = HttpRequest()
|
||||||
|
request.user = user
|
||||||
|
request.cloud_mode = False
|
||||||
|
request._messages = FakeMessages()
|
||||||
|
request.session = kwargs.get('session', {})
|
||||||
|
if kwargs.get('POST'):
|
||||||
|
request.method = 'POST'
|
||||||
|
request.POST = kwargs.get('POST')
|
||||||
|
else:
|
||||||
|
request.method = 'GET'
|
||||||
|
request.POST = kwargs.get('GET', {})
|
||||||
|
|
||||||
|
return request
|
||||||
|
|
||||||
|
class UserFactory(factory.Factory):
|
||||||
|
''' using the excellent factory_boy library '''
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _setup_next_sequence(cls):
|
||||||
|
# Instead of defaulting to starting with 0, start with 1.
|
||||||
|
return 1
|
||||||
|
|
||||||
|
email = factory.Sequence(lambda n: 'user%d@example.ecom' % n)
|
||||||
|
|
||||||
|
class FakeMessages:
|
||||||
|
''' mocks the Django message framework, makes it easier to get
|
||||||
|
the messages out '''
|
||||||
|
|
||||||
|
messages = []
|
||||||
|
|
||||||
|
def add(self, level, message, extra_tags):
|
||||||
|
self.messages.append(str(message))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pop(self):
|
||||||
|
return self.messages.pop()
|
Loading…
Reference in New Issue
Block a user