Ignore:
Timestamp:
Apr 12, 2006 3:24:08 PM (18 years ago)
Author:
mylan
Message:

plone 2.1 version with blogging APIs support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SimpleBlog/branches/plone-2.1-Blogging-APIs/Blog.py

    r211 r319  
    66import Permissions 
    77from Products.CMFCore.utils import getToolByName 
     8 
     9import MetaWeblogAPI 
     10import BloggerAPI 
     11import MovableTypeAPI 
     12 
    813 
    914schema = BaseFolderSchema +  Schema(( 
     
    96101                                                    condition="python:0", # this line have to be removed in order to be visible/editable 
    97102                                    description="Enter administrator's email for receaving notification about blog's activity"), 
    98                ) 
     103               ), 
     104    BooleanField('allowDelicious', 
     105                default = 1, 
     106                accessor = 'isDeliciousEnabled', 
     107                schemata = 'interface',  
     108                widget=BooleanWidget(label="Turn Delicious bookmarklet", 
     109                                    label_msgid="label_allow_delicious", 
     110                                    description_msgid="help_allow_delicious"), 
     111                ), 
     112    BooleanField('allowDigg', 
     113                default = 1, 
     114                accessor = 'isDiggEnabled', 
     115                schemata = 'interface', 
     116                widget=BooleanWidget(label="Turn Digg bookmarklet", 
     117                                    label_msgid="label_allow_digg", 
     118                                    description_msgid="help_allow_digg"), 
     119                ), 
     120    BooleanField('allowYahoo', 
     121                default = 1, 
     122                accessor = 'isYahooEnabled', 
     123                schemata = 'interface',  
     124                widget=BooleanWidget(label="Turn Yahoo bookmarklet", 
     125                                    label_msgid="label_allow_yahoo", 
     126                                    description_msgid="help_allow_yahoo"), 
     127                ), 
     128    BooleanField('allowGoogle', 
     129                default = 1, 
     130                accessor = 'isGoogleEnabled', 
     131                schemata = 'interface', 
     132                widget=BooleanWidget(label="Turn Google bookmarklet", 
     133                                    label_msgid="label_allow_google", 
     134                                    description_msgid="help_allow_google"), 
     135                ), 
     136    BooleanField('allowSpurl', 
     137                default = 1, 
     138                accessor = 'isSpurlEnabled', 
     139                schemata = 'interface',  
     140                widget=BooleanWidget(label="Turn Spurl bookmarklet", 
     141                                    label_msgid="label_allow_spurl", 
     142                                    description_msgid="help_allow_spurl"), 
     143                ), 
    99144    #BooleanField('allowComments', 
    100145    #              default = 1, 
     
    123168    global_allow=1 
    124169    schema=schema 
     170 
     171    blogger = None 
     172    metaWeblog = None 
    125173     
    126174    content_icon='simpleblog_icon.gif' 
     
    141189          'visible':0}) 
    142190 
     191    def initializeArchetype(self, **kwargs): 
     192        BaseFolder.initializeArchetype(self, **kwargs) 
     193        RPCAuth = self.simpleblog_tool.findRPCAuth(self) 
     194 
     195        # Setup the MetaWeblog API 
     196        self.metaWeblog = MetaWeblogAPI.MetaWeblogAPI().__of__(self) 
     197        self.metaWeblog.setupRPCAuth(RPCAuth) 
     198         
     199        # Setup the Blogger API 
     200        self.blogger = BloggerAPI.BloggerAPI().__of__(self) 
     201        self.blogger.setupRPCAuth(RPCAuth) 
     202 
     203        # Setup the MovableTypeAPI API 
     204        self.mt = MovableTypeAPI.MovableTypeAPI().__of__(self) 
     205        self.mt.setupRPCAuth(RPCAuth)     
     206 
    143207    def manage_afterAdd(self, item, container): 
    144208        BaseFolder.manage_afterAdd(self, item, container) 
     
    171235        return val 
    172236 
     237    def listCategories(self): 
     238        cats=self.getCategories() 
     239            
     240        # add the global categories 
     241        for c in self.simpleblog_tool.getGlobalCategories(): 
     242            if not c in cats: 
     243                cats.append(c)            
     244        cats = list(cats) 
     245        cats.sort() 
     246        return tuple(cats)                 
     247 
    173248registerType(Blog) 
    174249 
Note: See TracChangeset for help on using the changeset viewer.