[Hiki-cvs 1522] [1065] use @request instead of @cgi

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 9月 10日 (木) 23:02:31 JST


Revision: 1065
          http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=1065
Author:   okkez
Date:     2009-09-10 23:02:31 +0900 (Thu, 10 Sep 2009)

Log Message:
-----------
use @request instead of @cgi

Modified Paths:
--------------
    hiki/branches/rack/plugin/50bayes_filter.rb
    hiki/branches/rack/plugin/50word_filter.rb

Modified: hiki/branches/rack/plugin/50bayes_filter.rb
===================================================================
--- hiki/branches/rack/plugin/50bayes_filter.rb	2009-09-10 14:02:28 UTC (rev 1064)
+++ hiki/branches/rack/plugin/50bayes_filter.rb	2009-09-10 14:02:31 UTC (rev 1065)
@@ -20,20 +20,20 @@
 
   SubmittedPages = Struct.new(:ham, :spam, :doubt)
 
-  def initialize(cgi, conf, mode, db)
+  def initialize(request, conf, mode, db)
     BayesFilter.init(conf)
-    @cgi = cgi
+    @request = request
     @conf = conf
     @confmode = mode
     @db = db
   end
 
   def save_mode?
-    @cgi.request_method=="POST" and @confmode=="saveconf"
+    @request.request_method=="POST" and @confmode=="saveconf"
   end
 
   def html
-    case @mode =****@cgi*****['bfmode']
+    case @mode =****@reque*****['bfmode']
     when Mode::SUBMITTED_PAGES
       r = submitted_pages_html
     when Mode::SUBMITTED_PAGE_DIFF
@@ -69,22 +69,22 @@
     @conf[THRESHOLD] ||= 0.9
     @conf[THRESHOLD_HAM] ||= 0.1
 
-    if save_mode? and****@cgi*****["from_top"]
-      @conf[USE] =****@cgi*****[USE]
-      @conf[REPORT] =****@cgi*****[REPORT]
-      @conf[SHARE_DB] =****@cgi*****[SHARE_DB]
-      @conf[LIMIT_OF_SUBMITTED_PAGES] =****@cgi*****[LIMIT_OF_SUBMITTED_PAGES] || 50
-      threshold_spam = (@cgi.params[THRESHOLD]||0.95).to_f
-      threshold_ham = (@cgi.params[THRESHOLD_HAM]||0.05).to_f
+    if save_mode? and****@reque*****["from_top"]
+      @conf[USE] =****@reque*****[USE]
+      @conf[REPORT] =****@reque*****[REPORT]
+      @conf[SHARE_DB] =****@reque*****[SHARE_DB]
+      @conf[LIMIT_OF_SUBMITTED_PAGES] =****@reque*****[LIMIT_OF_SUBMITTED_PAGES] || 50
+      threshold_spam = (@request.params[THRESHOLD]||0.95).to_f
+      threshold_ham = (@request.params[THRESHOLD_HAM]||0.05).to_f
       if 0 <= threshold_ham and threshold_ham <= threshold_spam and threshold_spam <= 1.0
         @conf[THRESHOLD_HAM] = threshold_ham
         @conf[THRESHOLD] = threshold_spam
       end
 
       rebuild = false
-      rebuild = true if****@cgi*****["rebuild_db"]=="execute"
-      if****@cgi*****[TYPE] && @cgi.params[TYPE]!=@conf[TYPE]
-        @conf[TYPE] =****@cgi*****[TYPE]
+      rebuild = true if****@reque*****["rebuild_db"]=="execute"
+      if****@reque*****[TYPE] && @request.params[TYPE]!=@conf[TYPE]
+        @conf[TYPE] =****@reque*****[TYPE]
         rebuild = true
       end
 
@@ -181,7 +181,7 @@
   end
 
   def submitted_page_diff_html
-    return "" unless data = BayesFilter::PageData.load_from_cache(@cgi.params["id"].untaint)
+    return "" unless data = BayesFilter::PageData.load_from_cache(@request.params["id"].untaint)
     <<EOT
 <h3>#{Res.submitted_page_diff}</h3>
 <dl>
@@ -196,7 +196,7 @@
   end
 
   def page_token_html
-    return "" unless data = BayesFilter::PageData.load_from_cache(@cgi.params["id"].untaint)
+    return "" unless data = BayesFilter::PageData.load_from_cache(@request.params["id"].untaint)
     <<EOT
 <h3>#{Res.page_token}</h3>
 #{tokens_html(data.token)}
@@ -231,10 +231,10 @@
   def process_page_data
     return unless save_mode?
 
-    @cgi.params.keys.select{|k| k=~/\A[HSD]\d+\z/}.each do |id|
+    @request.params.keys.select{|k| k=~/\A[HSD]\d+\z/}.each do |id|
       data = BayesFilter::PageData.load_from_cache(id.dup.untaint, true)
       next unless data
-      case****@cgi*****["register_#{id}"]
+      case****@reque*****["register_#{id}"]
       when "ham"
         add_ham(data.token)
         data.corpus_save(true)
@@ -328,7 +328,7 @@
 if self.is_a?(::Hiki::Plugin)
   add_conf_proc( "bayes_filter",  BayesFilterConfig::Res.label) do
     begin
-      BayesFilterConfig.new(@cgi, @conf, @mode, @db).html
+      BayesFilterConfig.new(@request, @conf, @mode, @db).html
     rescue
       <<EOT
 <pre>

Modified: hiki/branches/rack/plugin/50word_filter.rb
===================================================================
--- hiki/branches/rack/plugin/50word_filter.rb	2009-09-10 14:02:28 UTC (rev 1064)
+++ hiki/branches/rack/plugin/50word_filter.rb	2009-09-10 14:02:31 UTC (rev 1065)
@@ -7,8 +7,8 @@
   key_words = "#{pre}.words"
 
   if****@cgi*****_method=="POST" and @mode=="saveconf"
-    @conf[key_use] =****@cgi*****[key_use]
-    @conf[key_words] =****@cgi*****[key_words]
+    @conf[key_use] =****@reque*****[key_use]
+    @conf[key_words] =****@reque*****[key_words]
   end
   old = @conf[key_words]
   @conf[key_words] ||= ""




Hiki-cvs メーリングリストの案内
Back to archive index