Ignore:
Timestamp:
May 28, 2010 11:41:57 AM (11 years ago)
Author:
mylan
Message:

#131: Added utilities for register/unregister SchemaExtender? adapter for an interface in Local SiteManager?

File:
1 edited

Legend:

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

    r2246 r2401  
    11from urllib2 import urlopen 
    22from urllib  import quote as urlquote 
     3 
     4from zope.component import getSiteManager 
    35 
    46from Globals import DevelopmentMode 
     
    68 
    79from quintagroup.plonegooglesitemaps import config 
     10from quintagroup.plonegooglesitemaps.content.newsextender import NewsExtender 
    811 
    912def ping_google(url, sitemap_id): 
     
    2427 
    2528    return 0 
     29 
     30def addLocalSchemaExtenderAdapter(context, iface): 
     31    """Register SchemaExtender adapter in 
     32       Local SiteManager for specified interface. 
     33    """ 
     34    sm = getSiteManager(context) 
     35    sm.registerAdapter(factory=NewsExtender, required=(iface,)) 
     36 
     37def removeLocalSchemaExtenderAdapter(context, iface): 
     38    """Unregister SchemaExtender adapter in 
     39       Local SiteManager for specified interface. 
     40    """ 
     41    sm = getSiteManager(context) 
     42    sm.unregisterAdapter(factory=NewsExtender, required=(iface,)) 
Note: See TracChangeset for help on using the changeset viewer.