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 | from Products.SimpleBlog import MetaWeblogAPI |
---|
33 | from Products.SimpleBlog import BloggerAPI |
---|
34 | from Products.SimpleBlog import MovableTypeAPI |
---|
35 | |
---|
36 | def migrateToAPIs(self): |
---|
37 | """ migrate existing SimpleBlog instance to support BloggingAPIs """ |
---|
38 | RPCAuth = self.simpleblog_tool.findRPCAuth(self) |
---|
39 | # Setup the MetaWeblog API |
---|
40 | self.metaWeblog = MetaWeblogAPI.MetaWeblogAPI().__of__(self) |
---|
41 | self.metaWeblog.setupRPCAuth(RPCAuth) |
---|
42 | # Setup the Blogger API |
---|
43 | self.blogger = BloggerAPI.BloggerAPI().__of__(self) |
---|
44 | self.blogger.setupRPCAuth(RPCAuth) |
---|
45 | # Setup the MovableTypeAPI API |
---|
46 | self.mt = MovableTypeAPI.MovableTypeAPI().__of__(self) |
---|
47 | self.mt.setupRPCAuth(RPCAuth) |
---|