Random ...
 
December 2017
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Tags ...
Links



python+zope++:: Making akizmet easy to use: Possible?
Posted at 08.Jan,2006 20:58  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

Akizmet, at its current state, works. However, currently, one needs to create a Script (Python) to short circuit the HTTP action for particular app, say addComment for COREBlog, or something else for some other app.

I haven't really given this a lot of thought, but what if we do it this way?

When instantiating an akizmet instance, we ask for the WP key and blog url. Now let's add some more fields::

  • the HTTP action we're shortcircuiting (the URL)
  • is it POST or GET?
  • where to redirect when everything's done

So, in pseudo code, we'll have:

  def __call__(self, REQUEST=None):
      """short circuit the call"""
     urlaction = self.shortcircuit
     id = someidgenerator()
     res = self.akizmet_comment_check(REQUEST)
     if not res:
          self.addAkizmetItem(id=id, title='',REQUEST=REQUEST)
          if self.action_to_do == 'post':
               #post via urllib2
               urllib2.post_the_bugger(REQUEST)
         else if self.action_to_do == 'get':
               #get the url with urllib2
               urllib2.get_the_bugger(REQUEST)
    else:
          self.addAkizmetItem(id=id, title='',REQUEST=REQUEST)
    REQUEST.RESPONSE.redirect(self.where_to_go)

This way, a user needs only to know what the action URL is and change the action to call the akizmet instance.

I don't have any concrete code yet, but I think this is workable.

Comments? Ideas?

updated it's to its not to self - need to reread before posting


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/64/tbping 

Comments
Post a comment