This class handles interactions with the forums database. It holds all the SQL
code used. Database operations include:
- create a forum
- delete a forum
- get the list of forums
- post a new message (start a thread)
- post a reply to a message
- get all the threads in a forum
- get all the posts in a thread
- get details of a message
This class operates asynchronously. The query methods (getTopMessages and
getThreadMessages) return Deferreds which will be called when the query has
finished.
This class caches the names of the forums in the database.
Methods
|
|
|
|
__init__
|
__init__ ( self, dbpool )
|
|
_finishPerspective
|
_finishPerspective ( self, result )
|
|
_forumCreator
|
_forumCreator (
self,
trans,
name,
description,
default_access,
)
|
|
_messagePoster
|
_messagePoster (
self,
trans,
forum_id,
user_name,
thread_id,
parent_id,
previous_id,
subject,
body,
)
|
|
_userCreator
|
_userCreator (
self,
trans,
username,
signature,
)
|
|
cacheForums
|
cacheForums ( self )
|
|
createForum
|
createForum (
self,
name,
description,
default_access,
)
Create a new forum with this name.
|
|
createUser
|
createUser (
self,
username,
signature,
)
Create a new user in the system and set default permissions.
This is complex as it must interface with the dbAuthorizer.
|
|
deleteForum
|
deleteForum ( self, forum_id )
Delete the forum with this name and all posted messages in it.
|
|
getForumByID
|
getForumByID ( self, id )
Get the name of a forum by it's ID.
|
|
getForums
|
getForums ( self, user_name )
Gets the list of forums and the number of msgs in each one. Only shows forums
the user has access to.
|
|
getFullMessages
|
getFullMessages (
self,
forum_id,
thread_id,
user_name,
)
Get the messages in a thread in a forum. This returns a set of columns
(id, parent_id, subject, post_date, username, body)
|
|
getMessage
|
getMessage ( self, post_id )
Get the details of a single message.
|
|
getThreadMessages
|
getThreadMessages (
self,
forum_id,
thread_id,
user_name,
)
Get the messages in a thread in a forum. This returns a set of columns
(id, parent_id, subject, post_date, username)
|
|
getTopMessages
|
getTopMessages (
self,
forum_id,
user_name,
)
Get the top-level messages in the forum - those that begin threads. This returns
a set of the columns (id, subject, post date, username, # replies) for the forum
|
|
gotForums
|
gotForums ( self, data )
|
|
loadPerspective
|
loadPerspective ( self, name )
|
|
newMessage
|
newMessage (
self,
forum_id,
user_name,
subject,
body,
)
Post a new message - start a new thread.
|
|
postMessage
|
postMessage (
self,
forum_id,
user_name,
thread_id,
parent_id,
previous_id,
subject,
body,
)
Post a message to a forum.
|
|