Logo Search packages:      
Sourcecode: zope-coreblog version File versions

def zope-coreblog-1.0::Entry::Entry::manage_editEntry (   self,
  author,
  body,
  extend,
  excerpt,
  moderated,
  main_category,
  sub_category = [],
  title = "",
  subtitle = "",
  format = format_plain,
  allow_comment = comment_open,
  receive_trackback = trackback_open,
  trackback_url = "",
  sendnow = 0,
  REQUEST = None,
  kw 
)

Edit Entry 

Definition at line 182 of file Entry.py.

                                      :
        """ Edit Entry """
        #COREBlog instanse
        cb = self.blog()
        #Validaters
        v_h = cb.removeHTML
        v_b = cb.validateEntryBody

      cooked_body = body
      if format in html_formats:
          cooked_body = v_b(body)
      
        #Field validation
        self.author = v_h(author)
        self.body = cooked_body
        self.rendered_body = cooked_body
        self.extend = v_b(extend)

        if not excerpt:
            prebody = v_h(get_rendered_body(body,format))
            excerpt = get_string_part(prebody,excerpt_length,cb.get_charcode())
            if len(excerpt) < len(prebody):
                excerpt = excerpt + "..."
        self.excerpt = html2text(v_h(excerpt))
        self.title = v_h(title)
        self.subtitle = v_h(subtitle)
        self.format = format

        self.allow_comment = allow_comment
        self.receive_trackback = receive_trackback

        #category handling
        cats_s = [main_category] + sub_category
        cats = []
        for id in cats_s:
            if not cb.categories.has_key(int(id)):
                raise ValueError,"Category of ID(%s) does not exist." % (str(id))
            cats.append(int(id))
        cats = make_unique(cats)

        pre_moderated = self.moderated

        if not pre_moderated and moderated:
            self.category = cats

        self.setModeration(moderated)

        #Reindex
        if moderated:
            self.index()

        if pre_moderated and self.moderated:
            #set category counts
            #decrement old category count
            if self.category:
                try:
                    cb.addCategoryCount(self.category[0],-1)
                except KeyError:
                    #Ignore when main category does not exist.
                    pass
            #increment old category count
            if cats:
                cb.addCategoryCount(cats[0],1)

        tburls = split_in_newline(trackback_url)

        #Remove unsent trackbacks
        for id in self.sendingtrackbacks.keys():
            stb = self.sendingtrackbacks[id]
            if stb.sent == 0:
                del self.sendingtrackbacks[id]

        addedtbs = 0
        #SendingTrackback
        for url in tburls:
            r = self.addSendingTrackback(url)
            if r:
                addedtbs = addedtbs + 1

        self.category = cats
        if not title:
            kw['worning_message'] = "Title is required."

        if REQUEST:
            if sendnow and addedtbs:
                #send trackback
                return REQUEST.RESPONSE.redirect('./manage_sendTrackback')
            else:
                #Set control values
                kw['noheader'] = 1
                kw['nocomment'] = 1
                kw['nocommentform'] = 1

                return self.manage_main(self,REQUEST,**kw)


    security.declareProtected(View, 'index_html')


Generated by  Doxygen 1.6.0   Back to index