annotate src/plugins/plugin_tmp_blog_banner.py @ 970:2e052998c7eb

jp: using C.APP_URL for application url
author Goffi <goffi@goffi.org>
date Wed, 02 Apr 2014 12:11:07 +0200
parents 10bb8574ab11
children
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
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # SAT temporary plugin for setting a blog banner
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_
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
22
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
23 PLUGIN_INFO = {
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
24 "name": "Blog Banner Plugin",
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
25 "import_name": "BLOG-BANNER",
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
26 "type": "TMP",
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
27 "protocols": [],
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
28 "dependencies": [],
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
29 "main": "BlogBanner",
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
30 "handler": "no",
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
31 "description": _("""Temporary plugin for setting a blog banner""")
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
32 }
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
33
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
34 PARAM_KEY = "Misc"
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
35 PARAM_NAME_BANNER = "Blog banner"
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
36
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
37
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
38 class BlogBanner(object):
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
39
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 <params>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
42 <individual>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
43 <category name="%(category_name)s" label="%(category_label)s">
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
44 <param name="%(param_name)s" label="%(param_label)s" value="" type="string" security="0"/>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
45 </category>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
46 </individual>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
47 </params>
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
48 """ % {
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
49 'category_name': PARAM_KEY,
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
50 'category_label': D_(PARAM_KEY),
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
51 'param_name': PARAM_NAME_BANNER,
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
52 'param_label': D_('Blog banner URL')
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
53 }
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
54
10bb8574ab11 plugin blog_banner: added temporary plugin with a user parameter to set a blog banner
souliane <souliane@mailoo.org>
parents:
diff changeset
55 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
56 host.memory.updateParams(self.params)