annotate src/common/constants.py @ 823:027139763511

server (blog): cleaning & improvments: - use a constant for themes url - moved RSM related constants to server only constants, and renamed theme STATIC_RSM* - raised the default number of items/comments to 10 - removed references to microblog namespace as it is managed by backend - many little improvments for better readability - dont use dynamic relative paths anymore - replaced use of old formatting syntax (%) by format() - profile name in url is now properly (un)quoted - removed max_items as it was used at the same time as RSM (TODO: check RSM support before using it) - renamed render_* methods using camelCase for consistency - put a limit for rsm_max, to avoid overloading - don't sort items after getting them anymore, as sorting is already done by backend/pubsub according to request - use urllib.urlencode when possible
author Goffi <goffi@goffi.org>
date Fri, 08 Jan 2016 14:42:39 +0100
parents f8a7a046ff9c
children 0c824ebe9d87
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
1 #!/usr/bin/python
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
3
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # Libervia: a SAT frontend
818
f8a7a046ff9c copyright update
Goffi <goffi@goffi.org>
parents: 796
diff changeset
5 # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org)
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
6
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # (at your option) any later version.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
11
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
16
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
19
624
9092e624bb27 browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents: 613
diff changeset
20 from sat_frontends.quick_frontend import constants
606
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
21 import os.path
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
22
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
23
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
24 class Const(constants.Const):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
25
613
deddd1cd8aa5 browser side: added a base_location property to get location of current Libervia instance
Goffi <goffi@goffi.org>
parents: 606
diff changeset
26 LIBERVIA_MAIN_PAGE = "libervia.html"
deddd1cd8aa5 browser side: added a base_location property to get location of current Libervia instance
Goffi <goffi@goffi.org>
parents: 606
diff changeset
27
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
28 # MISC
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
29 PASSWORD_MIN_LENGTH = 6 # for new account creation
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
30
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
31 # HTTP REQUEST RESULT VALUES
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
32 PROFILE_AUTH_ERROR = 'PROFILE AUTH ERROR'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
33 XMPP_AUTH_ERROR = 'XMPP AUTH ERROR'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
34 ALREADY_WAITING = 'ALREADY WAITING'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
35 SESSION_ACTIVE = 'SESSION ACTIVE'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
36 PROFILE_LOGGED = 'LOGGED'
796
fad9c9f82ae3 browser and server sides: alert the user after he created a new profile using his XMPP account credentials
souliane <souliane@mailoo.org>
parents: 793
diff changeset
37 PROFILE_LOGGED_REGISTERED_WITH_EXT_JID = 'LOGGED (REGISTERED WITH EXTERNAL JID)'
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
38 ALREADY_EXISTS = 'ALREADY EXISTS'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
39 REGISTRATION_SUCCEED = 'REGISTRATION'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
40 INTERNAL_ERROR = 'INTERNAL ERROR'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
41 BAD_REQUEST = 'BAD REQUEST'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
42 NO_REPLY = 'NO REPLY'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
43 NOT_ALLOWED = 'NOT ALLOWED'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
44 UPLOAD_OK = 'UPLOAD OK'
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 462
diff changeset
45 UPLOAD_KO = 'UPLOAD KO'
483
0bbbef1d53a8 server side (blog): use user's avatar a the blog's favicon + small refactorization
souliane <souliane@mailoo.org>
parents: 481
diff changeset
46
606
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
47 # directories
483
0bbbef1d53a8 server side (blog): use user's avatar a the blog's favicon + small refactorization
souliane <souliane@mailoo.org>
parents: 481
diff changeset
48 AVATARS_DIR = "avatars/"
606
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
49 MEDIA_DIR = "media/"
483
0bbbef1d53a8 server side (blog): use user's avatar a the blog's favicon + small refactorization
souliane <souliane@mailoo.org>
parents: 481
diff changeset
50
606
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
51 # avatars
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
52 DEFAULT_AVATAR_FILE = "default_avatar.png"
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
53 DEFAULT_AVATAR_URL = os.path.join(MEDIA_DIR, "misc", DEFAULT_AVATAR_FILE)
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
54 EMPTY_AVATAR_FILE = "empty_avatar"
7af8f4ab3675 browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents: 483
diff changeset
55 EMPTY_AVATAR_URL = os.path.join(MEDIA_DIR, "misc", EMPTY_AVATAR_FILE)