Last change
on this file since 458 was
79,
checked in by chervol, 18 years ago
|
branch plone2.0.5 fill in
|
File size:
844 bytes
|
Line | |
---|
1 | ## Script (Python) "listMetaTags" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters= |
---|
8 | ##title=Generate Keywords from SEO properties |
---|
9 | ## |
---|
10 | |
---|
11 | prop_name = 'qSEO_keywords' |
---|
12 | add_keywords = 'additional_keywords' |
---|
13 | |
---|
14 | keywords = [] |
---|
15 | if context.hasProperty(prop_name): |
---|
16 | keywords = context.getProperty(prop_name) |
---|
17 | |
---|
18 | pprops = context.portal_properties |
---|
19 | sheet = getattr(pprops, 'seo_properties', None) |
---|
20 | if sheet and sheet.hasProperty(add_keywords): |
---|
21 | keywords += sheet.getProperty(add_keywords) |
---|
22 | |
---|
23 | if keywords: |
---|
24 | return keywords |
---|
25 | |
---|
26 | accessor = 'Subject' |
---|
27 | |
---|
28 | method = getattr(context, accessor, None) |
---|
29 | if not callable(method): |
---|
30 | # ups |
---|
31 | return None |
---|
32 | |
---|
33 | # Catch AttributeErrors raised by some AT applications |
---|
34 | try: |
---|
35 | value = method() |
---|
36 | except AttributeError: |
---|
37 | value = None |
---|
38 | |
---|
39 | return value |
---|
Note: See
TracBrowser
for help on using the repository browser.