Changeset 3568 in products


Ignore:
Timestamp:
Oct 15, 2012 4:06:01 PM (7 years ago)
Author:
potar
Message:

fixed url for sitemap which is not in a site root; set absolute path for sitemap instead of id

Location:
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/handlers.py

    r3510 r3568  
    2727            if wftrans_name in sm.getPingTransitions() and \ 
    2828                    obj_ptype in sm.getPortalTypes(): 
    29                 ping_google(plone_home, sm.id) 
     29                ping_google(plone_home, url.getRelativeUrl(sm)) 
    3030    return 0 
    3131 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/skins/plonegooglesitemaps/gsm_edit_settings.cpy

    r1593 r3568  
    4747else: 
    4848    smselected = req.get('smselected', []) 
    49  
    5049    if req.get('form.button.Delete', False): 
    51         portal.manage_delObjects(ids=smselected[:]) 
     50        for sm_path in smselected: 
     51            sitemap = portal.restrictedTraverse(sm_path) 
     52            sitemap.aq_parent.manage_delObjects(sitemap.id) 
    5253        message = "Succesfully deleted: %s" % smselected 
    5354 
     
    5556        pinged = [] 
    5657        message = "Google pinged. It will review your sitemap as soon as it will be able to. Processed: %s" 
    57         for sm_id in smselected: 
     58        for sm_path in smselected: 
    5859            try: 
    59                 ping_google(portalURL, sm_id) 
     60                ping_google(portalURL, sm_path) 
    6061            except: 
    6162                message = "Cannot contact Google. Try again in a while. But pinged for: %s" 
    6263                break 
    6364            else: 
    64                 pinged.append(sm_id) 
     65                pinged.append(sm_path) 
    6566        message = message % pinged 
    6667 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/utils.py

    r3566 r3568  
    11from urllib import quote as urlquote 
    22from DateTime import DateTime 
     3from urlparse import urljoin 
    34import logging 
    45import urllib2 
     
    3637 
    3738 
    38 def ping_google(url, sitemap_id): 
     39def ping_google(plone_home, sitemap_relative_path): 
    3940    """Ping sitemap to Google""" 
    40  
    41     resurl = url + "/" + sitemap_id 
     41    resurl = urljoin(plone_home, sitemap_relative_path) 
    4242 
    4343    if DevelopmentMode or config.testing: 
Note: See TracChangeset for help on using the changeset viewer.