Ejemplo n.º 1
0
    def _get_blog_group(self, par):
        """ all blog articles in the group """

        group = Group.get_by_key_name(par[0])
        if group:
            q = group.content_set
            self._obj['title'] = group.title
            self._get_blog_list(q)
        else:
            return self._req.notfound()
Ejemplo n.º 2
0
    def _post_new_content(self, par):
        
        user = User(self._req.sesh())
        person = user.get_sesh_person()

        ut = Utils()
        key = ut.cleanUserName(self._req.par('cid'))

        # create the content record, by unique key - !important - replaces existing key - warn user?
        content = Content(key_name=key)
         
        content.status = 'draft'
        groupname = self._req.par('cgroup')
        content.group = Group.get_by_key_name(groupname)

        # create a new version
        contentver = ContentVersion()
        
        # some defaults
        contentver.title = self._req.par('ctitle')
        contentver.content = '<p>Placeholder for the body of your Article</p>' 
        contentver.summary = '<p>Placeholder for the article summary</p>' 
        contentver.person = person

        # have to put to get a reference
        contentver.put()

        # upate versions on this content
        content.current = contentver
        content.editing = contentver
        content.put()

        # link to my parent - in fact shouldnt I have used parents (but then sharding wont be an issue for a few, even 100's of, articles)
        contentver.mycontent = content
        contentver.put()

        # and redirect to the new content
        return self._req.redirect(path=self._conf.BLOG + '/' + groupname + '/' + key)