Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#904 closed task (fixed)

add a python 2.4 version

Reported by: sakkew Owned by: Sam Bloomquist
Priority: normal Component: ScrumBurndownPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description (last modified by Noah Kantrowitz)

When running python burndown_job.py D:\trac\proj I get :

Traceback (most recent call last):
  File "burndown_job.py", line 81, in ?
    main()
  File "burndown_job.py", line 28, in main
    env = open_environment(env_path)
  File "C:\Python24\Lib\site-packages\trac\env.py", line 436, in open_environmen
t
    raise TracError, 'The Trac Environment needs to be upgraded. Run ' \
trac.core.TracError: The Trac Environment needs to be upgraded. Run trac-admin D
:\trac\proj\ upgrade"

When I do python trac-admin d:\trac\proj upgrade I get:

Command failed: table burndown already exists

Attachments (1)

TracBurndown-01.03.10-py2.4.egg (22.4 KB) - added by dq@… 10 years ago.
Egg file with applied patch for python 2.4

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by Noah Kantrowitz

Description: modified (diff)

Fixing formatting.

comment:2 Changed 10 years ago by dq@…

Owner: changed from Sam Bloomquist to dq@…

I'm new at python and my only goal was to get this running for me.

Anyway, I look into the problem and it seems that execute doesn't accept more than 1 parameter. I'm not sure why the author decided to introduce extra parcing for the table name. The following works just the same.

cursor.execute('SELECT * FROM burndown LIMIT 1')

Anyway, I preferred to disturn the code as little as possible and let the author choose his own solution. Here's the diff for my change. Also attached to this ticket is a egg file for python 2.4 that I use.

Index: burndown/burndown.py
===================================================================
--- burndown/burndown.py        (revision 1603)
+++ burndown/burndown.py        (working copy)
@@ -40,7 +40,7 @@
         # See if the burndown table exists, if not, return True because we need to upgrade the database
         cursor = db.cursor()
         try:
-            cursor.execute('SELECT * FROM %s LIMIT 1', 'burndown')
+            cursor.execute('SELECT * FROM %s LIMIT 1' % 'burndown')
         except:
             needsUpgrade = True

Changed 10 years ago by dq@…

Egg file with applied patch for python 2.4

comment:3 Changed 10 years ago by dq@…

Owner: changed from dq@… to Sam Bloomquist

To the author:

Cool plugin... It you have questions, please drop me a mail.

comment:4 Changed 10 years ago by Sam Bloomquist

Resolution: fixed
Status: newclosed

(In [1607]) switched execute method in needsUpgrade() to not parse in the table name. fixes #904

comment:5 in reply to:  2 Changed 10 years ago by Sam Bloomquist

Replying to dq@ubit.com:

Anyway, I look into the problem and it seems that execute doesn't accept more than 1 parameter. I'm not sure why the author decided to introduce extra parcing for the table name.

I'm not sure why I did that either - probably because I fell victim to the old cut'n'paste from another example.

I was not aware that Python 2.4 doesn't accept 2 parameters for the execute method because I'm really not much more than a hack at Python - have only learned enough to get what I need done. Java and C++ pay my bills, and Ruby has edged out Python for my non-work programming.

Thanks for the fix.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Sam Bloomquist.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.