Last change
on this file since 1929 was
1928,
checked in by mylan, 14 years ago
|
#177: Add canonical_link indexer, fix canonical_path indexer
|
-
Property svn:eol-style set to
native
|
File size:
690 bytes
|
Rev | Line | |
---|
[1685] | 1 | from zope.interface import Interface |
---|
[782] | 2 | from zope.component import queryAdapter |
---|
[1685] | 3 | from plone.indexer.decorator import indexer |
---|
[782] | 4 | |
---|
| 5 | from interfaces import ICanonicalPath |
---|
[1928] | 6 | from interfaces import ICanonicalLink |
---|
[782] | 7 | |
---|
[1685] | 8 | @indexer(Interface) |
---|
| 9 | def canonical_path(obj, **kwargs): |
---|
[782] | 10 | """Return canonical_path property for the object. |
---|
| 11 | """ |
---|
[1928] | 12 | adapter = queryAdapter(obj, interface=ICanonicalPath) |
---|
| 13 | if adapter: |
---|
| 14 | return adapter.canonical_path |
---|
[782] | 15 | return None |
---|
[1928] | 16 | |
---|
| 17 | @indexer(Interface) |
---|
| 18 | def canonical_link(obj, **kwargs): |
---|
| 19 | """Return canonical_link property for the object. |
---|
| 20 | """ |
---|
| 21 | adapter = queryAdapter(obj, interface=ICanonicalLink) |
---|
| 22 | if adapter: |
---|
| 23 | return adapter.canonical_link |
---|
| 24 | return None |
---|
Note: See
TracBrowser
for help on using the repository browser.