Changeset 668
- Timestamp:
- 05/12/15 17:44:52 (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r666 r668 1 2.9.X: 2 * email2trac now supports discussionplugin v0.9dev. The older vcersions are not supported anymore, closes #365 3 Author: ??? 4 Applied by: Bas van der Vlies 5 1 6 2.8.9: 2 7 * Added a new parameter only save email and removed some obsolete code in ave_email_for_debug, -
trunk/email2trac.py.in
r666 r668 1544 1544 # 1545 1545 api = self.env[DiscussionApi] 1546 context = self._create_context(content, subject) 1546 args = {'forum' : self.id} 1547 context = self._create_context(api, args, content, subject) 1547 1548 1548 1549 ## Get forum for new topic. 1549 1550 # 1550 forum = api.get_forum(context, self.id)1551 forum = context.forum 1551 1552 1552 1553 if not forum: … … 1565 1566 # 1566 1567 self._add_topic(api, context, topic) 1567 self.db.commit()1568 1568 1569 1569 def discussion_topic_reply(self, content, subject): … … 1579 1579 # 1580 1580 api = self.env[DiscussionApi] 1581 context = self._create_context(content, subject) 1581 args = {'topic' : self.id} 1582 context = self._create_context(api, args, content, subject) 1582 1583 1583 1584 ## Get replied topic. 1584 1585 # 1585 topic = api.get_topic(context, self.id)1586 topic = context.topic 1586 1587 1587 1588 if not topic: … … 1600 1601 # 1601 1602 self._add_message(api, context, message) 1602 self.db.commit()1603 1603 1604 1604 def discussion_message_reply(self, content, subject): … … 1614 1614 # 1615 1615 api = self.env[DiscussionApi] 1616 context = self._create_context(content, subject) 1616 args = {'message' : self.id} 1617 context = self._create_context(api, args, content, subject) 1617 1618 1618 1619 ## Get replied message. 1619 1620 # 1620 message = api.get_message(context, self.id)1621 message = context.message 1621 1622 1622 1623 if not message: … … 1635 1636 # 1636 1637 self._add_message(api, context, message) 1637 self.db.commit() 1638 1639 def _create_context(self, content, subject): 1638 1639 def _create_context(self, api, args, content, subject): 1640 1640 1641 1641 ## Import modules. … … 1643 1643 from trac.mimeview import Context 1644 1644 from trac.web.api import Request 1645 from trac.web.session import Session 1645 1646 from trac.perm import PermissionCache 1646 1647 … … 1668 1669 req.perm = PermissionCache(self.env, self.author) 1669 1670 req.locale = None 1671 req.args = args 1672 req.session = Session(env, req) 1670 1673 1671 1674 ## Create and return context. … … 1673 1676 context = Context.from_request(req) 1674 1677 context.realm = 'discussion-email2trac' 1675 context. cursor = self.db.cursor()1678 context.db = self.env.get_db_cnx() 1676 1679 context.content = content 1677 1680 context.subject = subject … … 1682 1685 context.content_parts = self.unique_attachment_names( 1683 1686 context.content_parts) 1687 1688 api._prepare_context(context) 1684 1689 1685 1690 return context … … 1700 1705 ## Add a new topic. 1701 1706 # 1702 api.add_topic(context, topic)1707 new_topic_id = api.add_topic(context, topic) 1703 1708 1704 1709 ## Get inserted topic with new ID. 1705 1710 # 1706 topic = api.get_topic _by_time(context, topic['time'])1711 topic = api.get_topic(context, new_topic_id) 1707 1712 1708 1713 ## Attach attachments. … … 1731 1736 ## Add message. 1732 1737 # 1733 api.add_message(context, message)1738 new_msg_id = api.add_message(context, message) 1734 1739 1735 1740 ## Get inserted message with new ID. 1736 1741 # 1737 message = api.get_message _by_time(context, message['time'])1742 message = api.get_message(context, new_msg_id) 1738 1743 1739 1744 ## Attach attachments.
Note: See TracChangeset
for help on using the changeset viewer.