Last change
on this file was
1,
checked in by myroslav, 18 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
947 bytes
|
Rev | Line | |
---|
[1] | 1 | from Products.CMFCore.utils import getToolByName |
---|
| 2 | from config import ADSENSE_MAP |
---|
| 3 | |
---|
| 4 | def getCustomerId(context): |
---|
| 5 | pp = getToolByName(context, 'portal_properties') |
---|
| 6 | try: |
---|
| 7 | return pp.adsense_properties.getProperty('customer_id') or None |
---|
| 8 | except: |
---|
| 9 | return None |
---|
| 10 | |
---|
| 11 | def getCompiledAdsense(context, format, marker=""): |
---|
| 12 | if not ADSENSE_MAP.has_key(format): |
---|
| 13 | return marker |
---|
| 14 | width = ADSENSE_MAP[format]['width'] |
---|
| 15 | height = ADSENSE_MAP[format]['height'] |
---|
| 16 | customer_id = getCustomerId(context) |
---|
| 17 | if not customer_id: |
---|
| 18 | return marker |
---|
| 19 | try: |
---|
| 20 | return context.adsense_template(customer_id = customer_id \ |
---|
| 21 | ,adsense_width=width \ |
---|
| 22 | ,adsense_height=height \ |
---|
| 23 | ,adsense_format=format \ |
---|
| 24 | ) |
---|
| 25 | except: |
---|
| 26 | return marker |
---|
| 27 | |
---|
| 28 | def getAdsenseMap(): |
---|
| 29 | return ADSENSE_MAP |
---|
Note: See
TracBrowser
for help on using the repository browser.