[1] | 1 | def notifyTrackBack(change_state=None): |
---|
| 2 | if not change_state: |
---|
| 3 | return None |
---|
| 4 | obj = change_state.object |
---|
| 5 | portal = change_state.getPortal() |
---|
| 6 | # Get Blog object |
---|
| 7 | blog = obj |
---|
| 8 | while 1: |
---|
| 9 | if blog.meta_type == 'Blog': |
---|
| 10 | break |
---|
| 11 | blog = blog.aq_parent |
---|
| 12 | |
---|
| 13 | to_email = blog.getAdminEmail() |
---|
| 14 | from_email = portal.getProperty("email_from_address", "postmaster@localhost") |
---|
| 15 | if to_email: |
---|
| 16 | # get additional data for mail-template |
---|
| 17 | post_title = obj.aq_parent.Title() |
---|
| 18 | obj_url = obj.absolute_url() |
---|
| 19 | charset = portal.portal_properties.site_properties.getProperty('default_charset','utf-8') |
---|
| 20 | body = obj.notifyTBtemplate(from_email=from_email, \ |
---|
| 21 | to_email=to_email, \ |
---|
| 22 | charset=charset, \ |
---|
| 23 | post_title=post_title, \ |
---|
| 24 | obj_url=obj_url) |
---|
| 25 | try: |
---|
| 26 | mh = portal.MailHost |
---|
| 27 | mh.send(body) |
---|
| 28 | except: |
---|
| 29 | pass |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | #from Products.SimpleBlog import MetaWeblogAPI |
---|
| 34 | #from Products.SimpleBlog import BloggerAPI |
---|
| 35 | #from Products.SimpleBlog import MovableTypeAPI |
---|
| 36 | |
---|
| 37 | #def migrateToAPIs(self): |
---|
| 38 | #""" migrate existing SimpleBlog instance to support BloggingAPIs """ |
---|
| 39 | #RPCAuth = self.simpleblog_tool.findRPCAuth(self) |
---|
| 40 | ## Setup the MetaWeblog API |
---|
| 41 | #self.metaWeblog = MetaWeblogAPI.MetaWeblogAPI().__of__(self) |
---|
| 42 | #self.metaWeblog.setupRPCAuth(RPCAuth) |
---|
| 43 | ## Setup the Blogger API |
---|
| 44 | #self.blogger = BloggerAPI.BloggerAPI().__of__(self) |
---|
| 45 | #self.blogger.setupRPCAuth(RPCAuth) |
---|
| 46 | ## Setup the MovableTypeAPI API |
---|
| 47 | #self.mt = MovableTypeAPI.MovableTypeAPI().__of__(self) |
---|
| 48 | #self.mt.setupRPCAuth(RPCAuth) |
---|