Last change
on this file since 1593 was
1593,
checked in by mylan, 14 years ago
|
Add content from qPloneGoogleSitemaps. Fix all imports
|
-
Property svn:eol-style set to
native
|
File size:
958 bytes
|
Rev | Line | |
---|
[1593] | 1 | ## Script (Python) "create_verify_file" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=verify_filename |
---|
| 8 | ##title=Create file for verification |
---|
| 9 | ## |
---|
| 10 | |
---|
| 11 | from Products.CMFCore.utils import getToolByName |
---|
| 12 | from quintagroup.plonegooglesitemaps.utils import BadRequestException |
---|
| 13 | portal = getToolByName(context, 'portal_url').getPortalObject() |
---|
| 14 | try: |
---|
| 15 | portal.manage_addFile(verify_filename,title='Verification File') |
---|
| 16 | portal[verify_filename].manage_addProperty('CreatedBy','quintagroupt.plonegooglesitemaps','string') |
---|
| 17 | except BadRequestException: |
---|
| 18 | pass |
---|
| 19 | else: |
---|
| 20 | props = getToolByName(context,'portal_properties').googlesitemap_properties |
---|
| 21 | vfiles = list(props.getProperty('verification_filenames',[])) |
---|
| 22 | vfiles.append(verify_filename) |
---|
| 23 | props.manage_changeProperties(verification_filenames = vfiles) |
---|
| 24 | |
---|
| 25 | return state.set(portal_status_message = 'Plone Google Sitemap updated.') |
---|
Note: See
TracBrowser
for help on using the repository browser.