#2001 remove usage of deprecated cgi.escape function
Merged 2 years ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue1887  into  master

@@ -1,5 +1,4 @@ 

  #encoding UTF-8

- #import cgi

  #import koji

  #from kojiweb import util

  #from koji_cli.lib import greetings
@@ -51,7 +50,7 @@ 

                #end if

              </select>

              #try

-                 #set $old_terms = cgi.escape($terms)

+                 #set $old_terms = util.escapeHTML($terms)

              #except

                  #set $old_terms = ""

              #end try

file modified
+1 -2
@@ -1,4 +1,3 @@ 

- #import cgi

  #from kojiweb import util

  #from six.moves.urllib.parse import quote

  
@@ -14,7 +13,7 @@ 

          #end if

          <th>Search</th>

          #try

-             #set $old_terms = cgi.escape($terms)

+             #set $old_terms = util.escapeHTML($terms)

          #except

              #set $old_terms = ""

          #end try

file modified
+2 -3
@@ -21,7 +21,6 @@ 

  #       Mike McLean <mikem@redhat.com>

  from __future__ import absolute_import, division

  

- import cgi

  import datetime

  import hashlib

  import os
@@ -669,7 +668,7 @@ 

          else:

              text = self.text[:length]

          if self.need_escape:

-             text = cgi.escape(text)

+             text = escapeHTML(text)

          if self.size > 0 and text == '':

              text = self.empty_str_placeholder

          return '%s%s%s' % (self.begin_tag, text, self.end_tag)
@@ -725,7 +724,7 @@ 

                  size += fragment.size

  

          if self.need_escape:

-             line_text = cgi.escape(line_text)

+             line_text = escapeHTML(line_text)

  

          return '%s%s%s%s' % (self.begin_tag, line_text, postscript, self.end_tag)

  

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rewritten #1885, thanks to @mbelluzzo for pointing it out.

There was an unused reference to cgi module on 'taskinfo'. My original PR removed that as well. I don't see it on this one but I also didn't follow if it was done by any other previous PR.

Sorry, I'm not following this closely, but may be worth to double check since it was causing an import error even that unused when I tested.

yep, it is already gone. Only place, where cgi module is used is in wsgi_publisher cgi.FieldStorage and it still works in py3.9

Commit b6ea023 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago