Last change
on this file since 1 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
File size:
590 bytes
|
Rev | Line | |
---|
[1] | 1 | ## Script (Python) "qSEO_Description" |
---|
| 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 Description from SEO properties |
---|
| 9 | ## |
---|
| 10 | |
---|
| 11 | prop_name = 'qSEO_description' |
---|
| 12 | |
---|
| 13 | if context.hasProperty(prop_name): |
---|
| 14 | return context.getProperty(prop_name) |
---|
| 15 | |
---|
| 16 | accessor = 'Description' |
---|
| 17 | |
---|
| 18 | method = getattr(context, accessor, None) |
---|
| 19 | if not callable(method): |
---|
| 20 | # ups |
---|
| 21 | return None |
---|
| 22 | |
---|
| 23 | # Catch AttributeErrors raised by some AT applications |
---|
| 24 | try: |
---|
| 25 | value = method() |
---|
| 26 | except AttributeError: |
---|
| 27 | value = None |
---|
| 28 | |
---|
| 29 | return value |
---|
Note: See
TracBrowser
for help on using the repository browser.