def newRole(self): role = VirtualRow(AlineaRole) role.id = self.roleID role.users = [] role.label = '' roles = self.getFromSession('editingRoles', {}) roles[role.id] = role self.storeToSession('editingRoles', roles)
def newUser(self): user = VirtualRow(AlineaUser.AlineaUser) user.id = self.userID user.articles = [] user.roles = [] users = self.getFromSession('editingUsers', {}) users[user.id] = user self.storeToSession('editingUsers', users) return user
def newArticle(self): """ Create a skeleton for a new Article. Return a VirtualRow acting as an AlineaArticle """ date = datetime.datetime.now() userID = self.getLoggedUser().id article = VirtualRow(AlineaArticle) article.date = date article.lastModified = date article.alineaUserID = userID article.id = self.articleID article.publicID = self.articleID article.published = False article.alineaComments = [] article.title = 'New Article' article.alineaSection = None article.alineaSectionID = None article.hits = 0 if self.sectionID is not None: article.alineaSectionID = int(self.sectionID) return article