|
Revision 589
(checked in by mylan, 2 years ago)
|
Add and register CanonicalURL adapter.cd '/data/mylan/opt/work/SimpleBlog/adsenseproduct/Extensions'
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
from Products.CMFCore.utils import getToolByName |
|---|
| 2 |
|
|---|
| 3 |
def getCanonicalURL(context): |
|---|
| 4 |
""" Uniform method for get portal canonical url.""" |
|---|
| 5 |
p_url = getToolByName(context, 'portal_url') |
|---|
| 6 |
canonical_url = "" |
|---|
| 7 |
try: |
|---|
| 8 |
from adapter import ICanonicalURL |
|---|
| 9 |
canonical_url = ICanonicalURL(p_url).getCanonicalURL() |
|---|
| 10 |
except: |
|---|
| 11 |
canonical_url = p_url.getCanonicalURL() |
|---|
| 12 |
|
|---|
| 13 |
return canonical_url |
|---|