annotate src/plugins/plugin_misc_static_blog.py @ 1060:aa15453ec54d

core (xmpp), stdui (profile_manager), bridge, frontends: raise an exception if the XMPP connection failed instead of sending a signal
author souliane <souliane@mailoo.org>
date Fri, 23 May 2014 09:59:35 +0200
parents adbde4a3a52f
children 4c48e2549592
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
1 #!/usr/bin/python
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
3
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
4 # SAT plugin for static blogs
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
5 # Copyright (C) 2014 Adrien Cossa (souliane@mailoo.org)
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
6
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # (at your option) any later version.
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
11
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
16
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
19
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
20
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
21 from sat.core.i18n import _, D_
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
22 from sat.core.constants import Const as C
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
23
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
24
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
25 PLUGIN_INFO = {
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
26 "name": "Static Blog Plugin",
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
27 "import_name": "STATIC-BLOG",
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
28 "type": "MISC",
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
29 "protocols": [],
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
30 "dependencies": [],
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
31 "main": "StaticBlog",
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
32 "handler": "no",
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
33 "description": _("""Plugin for static blogs""")
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
34 }
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
35
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
36
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
37 class StaticBlog(object):
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
38
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
39 params = """
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
40 <params>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
41 <individual>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
42 <category name="%(category_name)s" label="%(category_label)s">
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
43 <param name="%(title_name)s" label="%(title_label)s" value="" type="string" security="0"/>
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
44 <param name="%(banner_name)s" label="%(banner_label)s" value="" type="string" security="0"/>
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
45 <param name="%(keywords_name)s" label="%(keywords_label)s" value="" type="string" security="0"/>
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
46 <param name="%(description_name)s" label="%(description_label)s" value="" type="string" security="0"/>
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
47 </category>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
48 </individual>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
49 </params>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
50 """ % {
1020
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
51 'category_name': C.STATIC_BLOG_KEY,
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
52 'category_label': D_(C.STATIC_BLOG_KEY),
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
53 'title_name': C.STATIC_BLOG_PARAM_TITLE,
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
54 'title_label': D_('Page title'),
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
55 'banner_name': C.STATIC_BLOG_PARAM_BANNER,
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
56 'banner_label': D_('Banner URL'),
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
57 'keywords_name': C.STATIC_BLOG_PARAM_KEYWORDS,
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
58 'keywords_label': D_('Keywords'),
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
59 'description_name': C.STATIC_BLOG_PARAM_DESCRIPTION,
adbde4a3a52f plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents: 890
diff changeset
60 'description_label': D_('Description'),
890
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
61 }
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
62
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
63 def __init__(self, host):
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
64 host.memory.updateParams(self.params)