[glom/glom-1-20] Small fix to epository_analyzer_begin_scan example script.



commit dc4a68c54326f3760d6a4ec3b8bb394af0b0a2b4
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Dec 12 10:10:49 2011 +0100

    Small fix to epository_analyzer_begin_scan example script.
    
    * examples/example_scripts/repository_analyzer_begin_scan.py:
    Remove the global variables, used for debugging, because recent versions of
    Python do not seem to treat them as global when this script is used as
    a Button script in python. So it says they are undefined. They are, after
    all, inside the function that glom defines.
    Although they would still work in this standalone script, it is nice to
    have no difference between this file and the one used in this .glom file:
    https://gitorious.org/debian_repository_analyzer/debian_repository_analyzer

 ChangeLog                                          |   13 +++++++
 .../repository_analyzer_begin_scan.py              |   34 --------------------
 2 files changed, 13 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fbd128b..2f379b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-12-12  Murray Cumming  <murrayc murrayc com>
+
+	Small fix to epository_analyzer_begin_scan example script.
+
+	* examples/example_scripts/repository_analyzer_begin_scan.py:
+	Remove the global variables, used for debugging, because recent versions of 
+	Python do not seem to treat them as global when this script is used as 
+	a Button script in python. So it says they are undefined. They are, after 
+	all, inside the function that glom defines.
+	Although they would still work in this standalone script, it is nice to 
+	have no difference between this file and the one used in this .glom file:
+	https://gitorious.org/debian_repository_analyzer/debian_repository_analyzer
+
 2011-12-09  Murray Cumming  <murrayc murrayc com>
 
 	Combo_TextGlade: Work around GtkComboBoxText bug #612396.
diff --git a/examples/example_scripts/repository_analyzer_begin_scan.py b/examples/example_scripts/repository_analyzer_begin_scan.py
index 2389957..35d4754 100644
--- a/examples/example_scripts/repository_analyzer_begin_scan.py
+++ b/examples/example_scripts/repository_analyzer_begin_scan.py
@@ -29,22 +29,6 @@ import apt # For apt.Cache.
 import apt_pkg # For apt_pkg.SourceRecords
 import difflib
 
-record = None
-do_sql = True
-
-def debug_create_connection_record():
-    cnc_string = "HOST=localhost;PORT=5434;DB_NAME=glom_repositoryanalyzer3121"
-    auth_string = "USERNAME=glom_default_developer_user;PASSWORD=glom_default_developer_password"
-    gda_connection = Gda.Connection.open_from_string("PostgreSQL", cnc_string, auth_string, Gda.ConnectionOptions.NONE)
-
-
-    class TestRecord:
-        connection = None
-
-    global record
-    record = TestRecord()
-    record.connection = gda_connection
-    return record
 
 class DebugWindow:
     debug_window = None
@@ -1328,15 +1312,6 @@ def get_package_data_list(out_licenses_map, package_names_list_restrict_to):
 def execute_sql_non_select_query(query_text):
 
     #print "debug: sql=%s" % query_text
-    
-    global do_sql
-    if(not do_sql):
-        return 0
-
-    #For debugging, outside of Glom:
-    global record
-    if(record == None):
-        record = debug_create_connection_record()
      
     #We use encode() here because, when running inside Glom, gda.Command() somehow expects an ascii string and tries to convert the unicode string to ascii, causing exceptions because the conversion does not default to 'replace'.
     #TODO: Find out why it acts differently inside Glom. This is not a problem when running normally as a standalone script.
@@ -1346,15 +1321,6 @@ def execute_sql_non_select_query(query_text):
     
 def execute_sql_select_query(query_text):
 
-    global do_sql
-    if(not do_sql):
-        return 0
-
-    #For debugging, outside of Glom:
-    global record
-    if(record == None):
-        record = debug_create_connection_record()
-
     #We use encode() here because, when running inside Glom, gda.Command() somehow expects an ascii string and tries to convert the unicode string to ascii, causing exceptions because the conversion does not default to 'replace'.
     #TODO: Find out why it acts differently inside Glom. This is not a problem when running normally as a standalone script.
     command = query_text.encode('ascii', 'replace')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]