Пример #1
0
    def _post_change_current(self, par):
    
        key = self._pl['id']
        ver = int(self._pl['verid'])

        content = Content.get_by_key_name(key)
        contentver = ContentVersion.get_by_id(ver)

        content.current = contentver
        content.put()
Пример #2
0
    def _post_change_current(self, par):

        key = self._pl["id"]
        ver = int(self._pl["verid"])

        content = Content.get_by_key_name(key)
        contentver = ContentVersion.get_by_id(ver)

        content.current = contentver
        content.put()

        # respond with a good code
        self._req.draw_code()
Пример #3
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)