Difference between revisions of "User:Alvonruff/Python3 Files"

From ISFDB
Jump to navigation Jump to search
Line 262: Line 262:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| adv_notes_search.py
 
| adv_notes_search.py
Line 270: Line 270:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| advSearchClass.py
 
| advSearchClass.py
Line 278: Line 278:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| adv_search_menu.py
 
| adv_search_menu.py
Line 286: Line 286:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| adv_search_results.py
 
| adv_search_results.py
Line 294: Line 294:
 
| Y
 
| Y
 
| -
 
| -
|
+
| Y
 
|-
 
|-
 
| adv_search_selection.py
 
| adv_search_selection.py
Line 302: Line 302:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| adv_user_search.py
 
| adv_user_search.py
Line 310: Line 310:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| adv_web_page_search.py
 
| adv_web_page_search.py
Line 318: Line 318:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| ae.py
 
| ae.py
Line 326: Line 326:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| author_history.py
 
| author_history.py
Line 334: Line 334:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| authors_by_debut_year.py
 
| authors_by_debut_year.py
Line 342: Line 342:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| authors_by_debut_year_table.py
 
| authors_by_debut_year_table.py
Line 350: Line 350:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| authortags.py
 
| authortags.py
Line 358: Line 358:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| award_category_history.py
 
| award_category_history.py
Line 366: Line 366:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| award_category.py
 
| award_category.py
Line 374: Line 374:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| award_category_year.py
 
| award_category_year.py
Line 382: Line 382:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| award_details.py
 
| award_details.py
Line 390: Line 390:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| award_directory.py
 
| award_directory.py
Line 398: Line 398:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| award_history.py
 
| award_history.py
Line 406: Line 406:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| awardtype_history.py
 
| awardtype_history.py
Line 414: Line 414:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| awardtype.py
 
| awardtype.py
Line 422: Line 422:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| ay.py
 
| ay.py
Line 430: Line 430:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| biblio.py
 
| biblio.py
Line 438: Line 438:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| calendarClass.py
 
| calendarClass.py
Line 446: Line 446:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| calendar_day.py
 
| calendar_day.py
Line 454: Line 454:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| calendar_menu.py
 
| calendar_menu.py
Line 462: Line 462:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| cancelsubmission.py
 
| cancelsubmission.py
Line 470: Line 470:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| changed_verified_pubs.py
 
| changed_verified_pubs.py
Line 478: Line 478:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| ch.py
 
| ch.py
Line 486: Line 486:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| common.py
 
| common.py
Line 494: Line 494:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| diffselect.py
 
| diffselect.py
Line 502: Line 502:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| directory.py
 
| directory.py
Line 510: Line 510:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| dologin.py
 
| dologin.py
Line 518: Line 518:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| dologout.py
 
| dologout.py
Line 526: Line 526:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| dumpxml.py
 
| dumpxml.py
Line 534: Line 534:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| ea.py
 
| ea.py
Line 542: Line 542:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| eaw.py
 
| eaw.py
Line 550: Line 550:
 
| Y
 
| Y
 
| -
 
| -
|
+
| -
 
|-
 
|-
 
| external_id_search_results.py
 
| external_id_search_results.py

Revision as of 08:07, 10 June 2023

This page tracks changes that can be made and still run under Python2.

This page tracks changes that can be made for Python3 that also run fine under Python2. The changes are:

  • Replacing tabs with 8 spaces. Almost every file attempted so far has some mix of spaces and tabs. In vi/vim this can be changed with:
   :s/<tab>/<8 spaces>/g
  • Change all print statements to use function call syntax. This can be done by 2to3 (a variant of futurize). 2to3 without arguments will make many python3 changes, but it also takes a -f argument, which allows you to attack one specific problem. To use, create a target directory (like FUTURIZE), and issuing the following command:
   2to3 awardClass.py -f print -n -w -o FUTURIZE
  • Change all instance of string.method to str.method.
  • While most SQL code is in SQLparsing.py, it is also peppered across many other files. This code will not work any longer, as Python3 requires moving to a new connector. I've created an ISFDB connector class which is portable across Python2 and Python3. Some usage patterns are:

FETCHMANY:

   def _StandardQuery(query):
       CNX = MYSQL_CONNECTOR()
       CNX.DB_QUERY(query)
       results = []
       record = CNX.DB_FETCHMANY()
       while record:
               results.append(record[0])
               record = CNX.DB_FETCHMANY()
       return results

NUMROWS:

   def _BinaryQuery(query):
       CNX = MYSQL_CONNECTOR()
       CNX.DB_QUERY(query)
       if CNX.DB_NUMROWS():
               return 1
       else:
               return 0

FETCHONE:

   def _OneRow(query):
       CNX = MYSQL_CONNECTOR()
       CNX.DB_QUERY(query)
       record = CNX.DB_FETCHONE()
       if record:
               return record[0]
       else:
               return None

DB_ESCAPE_STRING:

   def SQLgetAuthorData(author):
       CNX = MYSQL_CONNECTOR()
       query = "select %s from authors where author_canonical='%s'" % (CNX_AUTHORS_STAR, CNX.DB_ESCAPE_STRING(author))
       CNX.DB_QUERY(query)
       record = CNX.DB_FETCHONE()
       if record:
               return record[0]
       else:
               return 0

DB_INSERT_ID:

       CNX = MYSQL_CONNECTOR()
       query = "insert into titles(title_title) values('%s');" % (CNX.DB_ESCAPE_STRING(title))
       CNX.DB_QUERY(query)
       record = CNX.DB_INSERT_ID()
  • We also need to remove all of the stray import MySQLdb statements. MySQLdb is imported by SQLparsing under Python2, and causes an error on Python3.

Common

File Tabs Print String DB Connector encode FieldStorage
authorClass.py Y Y Y Y - Y
awardcatClass.py Y Y Y Y - Y
awardClass.py Y Y Y Y - Y
awardtypeClass.py Y Y Y Y - Y
install.py Y Y Y - - -
isbn.py Y Y Y Y - -
isfdblib.py - - - - - -
isfdb.py Y Y Y Y Y -
library.py Y Y Y Y Y -
localdefs.py - - - - - -
login.py Y Y Y Y - -
navbar.py Y Y Y Y - -
pubClass.py Y Y Y Y - Y
publisherClass.py Y Y Y Y - Y
pubseriesClass.py Y Y Y Y - Y
seriesClass.py Y Y Y Y - Y
sfe3.py Y Y Y Y - -
SQLparsing.py Y Y Y Y Y -
templateClass.py Y Y Y Y - Y
titleClass.py Y Y Y Y - Y
verificationsourceClass.py Y Y Y Y - Y
viewers.py Y Y Y Y Y -

Biblio

File Tabs Print String DB Connector encode FieldStorage
adv_identifier_search.py Y Y Y Y - -
adv_notes_search.py Y Y Y Y - -
advSearchClass.py Y Y Y Y - -
adv_search_menu.py Y Y Y Y - -
adv_search_results.py Y Y Y Y - Y
adv_search_selection.py Y Y Y Y - -
adv_user_search.py Y Y Y Y - -
adv_web_page_search.py Y Y Y Y - -
ae.py Y Y Y Y - -
author_history.py Y Y Y Y - -
authors_by_debut_year.py Y Y Y Y - -
authors_by_debut_year_table.py Y Y Y Y - -
authortags.py Y Y Y Y - -
award_category_history.py Y Y Y Y - -
award_category.py Y Y Y Y - -
award_category_year.py Y Y Y Y - -
award_details.py Y Y Y Y - -
award_directory.py Y Y Y Y - -
award_history.py Y Y Y Y - -
awardtype_history.py Y Y Y Y - -
awardtype.py Y Y Y Y - -
ay.py Y Y Y Y - -
biblio.py Y Y Y Y - -
calendarClass.py Y Y Y Y - -
calendar_day.py Y Y Y Y - -
calendar_menu.py Y Y Y Y - -
cancelsubmission.py Y Y Y Y - -
changed_verified_pubs.py Y Y Y Y - -
ch.py Y Y Y Y - -
common.py Y Y Y Y - -
diffselect.py Y Y Y Y - -
directory.py Y Y Y Y - -
dologin.py Y Y Y Y - -
dologout.py Y Y Y Y - -
dumpxml.py Y Y Y Y - -
ea.py Y Y Y Y - -
eaw.py Y Y Y Y - -
external_id_search_results.py Y Y Y Y -
fc.py Y Y Y Y -
google_search_redirect.py Y Y Y Y -
index.py Y Y Y Y -
languages.py Y Y Y Y -
most_popular.py Y Y Y Y -
most_popular_table.py Y Y Y Y -
most_reviewed.py Y Y Y Y -
most_reviewed_table.py Y Y Y Y -
mylanguages.py Y Y Y Y -
mypreferences.py Y Y Y Y -
myrecent.py Y Y Y Y -
my_removed_secondary_verifications.py Y Y Y Y -
my_secondary_verifications.py Y Y Y Y -
my_unstable_ISBN_verifications.py Y Y Y Y -
my_unstable_verifications.py Y Y Y Y -
myverificationsClass.py Y Y Y Y -
my_verifications_menu.py Y Y Y Y -
myvotes.py Y Y Y Y -
mywebsites.py Y Y Y Y -
note.py Y Y Y Y -
note_search_results.py Y Y Y Y -
pe.py Y Y Y Y -
pl.py Y Y Y Y
popular_authors.py Y Y Y Y -
popular_authors_table.py Y Y Y Y -
pub_history.py Y Y Y Y -
publisher_authors.py Y Y Y Y -
publisher_history.py Y Y Y Y
publisher_one_author.py Y Y Y Y -
publisher.py Y Y Y Y -
publisheryear.py Y Y Y Y -
pubseries_history.py Y Y Y Y -
pubseries.py Y Y Y Y -
pubs_not_in_series.py Y Y Y Y -
recent_activity_menu.py Y Y Y Y -
recent_primary_ver.py Y Y Y Y -
recent.py Y Y Y Y -
recentver.py Y Y Y Y -
removed_secondary_verifications.py Y Y Y Y -
se.py Y Y Y Y -
seriesgrid.py Y Y Y Y -
series_history.py Y Y Y Y -
seriestags.py Y Y Y Y -
stats-and-tops.py Y Y Y Y -
stats.py Y Y Y Y -
submitdiff.py Y Y Y Y -
submitlogin.py Y Y Y Y Y
submitmylanguages.py Y Y Y Y -
submitmywebsites.py Y Y Y Y -
submitpreferences.py Y Y Y Y -
tag_author.py Y Y Y Y -
tag.py Y Y Y Y -
titlecovers.py Y Y Y Y -
title_history.py Y Y Y Y -
title.py Y Y Y Y -
topcontrib.py Y Y Y Y -
user_search_results.py Y Y Y Y -
usertag.py Y Y Y Y -
usertitles.py Y Y Y Y -
userver.py Y Y Y Y -
utils.py Y Y Y Y -
verification_sources.py Y Y Y Y -
view_submission.py Y Y Y Y -
webpages_search_results.py Y Y Y Y -

Edit

File Tabs Print String DB Connector
addawardcat.py Y Y Y Y
addaward.py Y Y Y Y
addpub.py Y Y Y Y
addquicktag.py Y Y Y Y
add_template.py Y Y Y Y
addvariant.py Y Y Y Y
add_verification_source.py Y Y Y Y
as_merge.py Y Y Y Y
av_merge.py Y Y Y Y
cleanup_lib.py Y Y Y Y
cleanup.py Y Y Y Y
cleanup_report.py Y Y Y Y
clonecontent.py Y Y Y Y
clone_intermediate.py Y Y Y Y
clonepub.py Y Y Y Y
deleteawardcat.py Y Y Y Y
deleteaward.py Y Y Y Y
deleteawardtype.py Y Y Y Y
deletepub.py Y Y Y Y
deleteseries.py Y Y Y Y
deletetitle.py Y Y Y Y
editauth.py Y Y Y Y
editawardcat.py Y Y Y Y
editaward.py Y Y Y Y
editawardtype.py Y Y Y Y
editpublisher.py Y Y Y Y
editpub.py Y Y Y Y
editpubseries.py Y Y Y Y
editseries.py Y Y Y Y
edittags.py Y Y Y Y
edit_template.py Y Y Y Y
edittitle.py Y Y Y Y
edit_verification_source.py Y Y Y Y
empty_containers.py Y Y Y Y
exportcontent.py Y Y Y Y
find_dups.py Y Y Y Y
find_pub_dups.py Y Y Y Y
find_title_dups.py Y Y Y Y
importcontent.py Y Y Y Y
incomplete_contents.py Y Y Y Y
isfdblib.py Y Y Y Y
isfdblib_help.py Y Y Y Y
isfdblib_print.py Y Y Y Y
keygen.py Y Y Y Y
linkaward.py Y Y Y Y
linkreview.py Y Y Y Y
login.py Y Y Y Y
mkpseudo.py Y Y Y Y
mkvariant.py Y Y Y Y
newawardtype.py Y Y Y Y
new_language.py Y Y Y Y
newpub.py Y Y Y Y
numeric_external_id_ranges.py Y Y Y Y
ps_merge.py Y Y Y Y
publisher_exceptions.py Y Y Y Y
pv_merge.py Y Y Y Y
rmtitles.py Y Y Y Y
select_award_type.py Y Y Y Y
sfe3_authors.py Y Y Y Y
submitaddpub.py Y Y Y Y
submit_add_template.py Y Y Y Y
submit_add_verification_source.py Y Y Y Y
submitauth.py Y Y Y Y
submitawardcat.py Y Y Y Y
submitaward.py Y Y Y Y
submitawardtype.py Y Y Y Y
submitclone.py Y Y Y Y
submitdelaward.py Y Y Y Y
submitdeleteawardcat.py Y Y Y Y
submitdeleteawardtype.py Y Y Y Y
submitdelpub.py Y Y Y Y
submitdelseries.py Y Y Y Y
submitdeltitle.py Y Y Y Y
submit_edit_template.py Y Y Y Y
submit_edit_verification_source.py Y Y Y Y
submitlinkaward.py Y Y Y Y
submitlinkreview.py Y Y Y Y
submitmkpseudo.py Y Y Y Y
submitmkvar1.py Y Y Y Y
submitmkvar2.py Y Y Y Y
submitnewawardcat.py Y Y Y Y
submitnewaward.py Y Y Y Y
submitnewawardtype.py Y Y Y Y
submit_new_language.py Y Y Y Y
submitnewpub.py Y Y Y Y
submit_primary_verification.py Y Y Y Y
submitpublisher.py Y Y Y Y
submitpub.py Y Y Y Y
submitpubseries.py Y Y Y Y
submitrempseudo.py Y Y Y Y
submitrm.py Y Y Y Y
submit_select_award_type.py Y Y Y Y
submitseries.py Y Y Y Y
submittags.py Y Y Y Y
submittitle.py Y Y Y Y
submitvariant.py Y Y Y Y
submitver.py Y Y Y Y
submitvote.py Y Y Y Y
ts_merge.py Y Y Y Y
ts_unmerge.py Y Y Y Y
tv_merge.py Y Y Y Y
tv_unmerge.py Y Y Y Y
verify.py Y Y Y Y
vote.py Y Y Y Y

Mod

File Tabs Print String DB Connector
aa_merge.py Y Y Y Y
aa_update.py Y Y Y Y
award_cat_delete_file.py Y Y Y Y
award_cat_new_file.py Y Y Y Y
award_cat_update_file.py Y Y Y Y
award_link_file.py Y Y Y Y
award_type_delete_file.py Y Y Y Y
award_type_new_file.py Y Y Y Y
award_type_update_file.py Y Y Y Y
bad_images.py Y Y Y Y
bureaucrat.py Y Y Y Y
ca_new.py Y Y Y Y
change_tag_status.py Y Y Y Y
common.py Y Y Y Y
cpanel.py Y Y Y Y
hardreject.py Y Y Y Y
hold.py Y Y Y Y
isfdblib.py Y Y Y Y
ka_new.py Y Y Y Y
list.py Y Y Y Y
list_templates.py Y Y Y Y
list_verification_sources.py Y Y Y Y
marque.py Y Y Y Y
new_language_file.py Y Y Y Y
pa_delete.py Y Y Y Y
pa_new.py Y Y Y Y
pa_update.py Y Y Y Y
private_tags.py Y Y Y Y
ra_link.py Y Y Y Y
recent.py Y Y Y Y
reject.py Y Y Y Y
remove_secondary_verification.py Y Y Y Y
remove_tag.py Y Y Y Y
resolve_bad_url.py Y Y Y Y
resolve_cleanup.py Y Y Y Y
resolve_empty_containers.py Y Y Y Y
resolve_sfe3_url.py Y Y Y Y
sa_delete.py Y Y Y Y
sa_update.py Y Y Y Y
select_secondary_verification.py Y Y Y Y
self_approver_file.py Y Y Y Y
self_approvers.py Y Y Y Y
submission_review.py Y Y Y Y
submission_search.py Y Y Y Y
submission_search_results.py Y Y Y Y
submitcpanel.py Y Y Y Y
submitref.py Y Y Y Y
ta_delete.py Y Y Y Y
tag_breakdown.py Y Y Y Y
tag_status_changes.py Y Y Y Y
ta_merge.py Y Y Y Y
ta_remove.py Y Y Y Y
ta_unmerge.py Y Y Y Y
ta_update.py Y Y Y Y
template_add_file.py Y Y Y Y
template_update_file.py Y Y Y Y
ua_merge.py Y Y Y Y
unhold.py Y Y Y Y
unreject.py Y Y Y Y
va_new.py Y Y Y Y
verification_source_add_file.py Y Y Y Y
verification_source_file.py Y Y Y Y
wa_delete.py Y Y Y Y
wa_new.py Y Y Y Y
wa_update.py Y Y Y Y
xa_update.py Y Y Y Y
ya_new.py Y Y Y Y
ya_remove.py Y Y Y Y
za_update.py Y Y Y Y

Rest

File Tabs Print String DB Connector encode FieldStorage
getpub_by_ID.py Y Y Y Y
getpub_by_internal_ID.py
getpub.py
pub_output.py Y Y Y Y
submission.py