Modify

Opened 3 years ago

Closed 2 years ago

#9793 closed defect (fixed)

Setting new billing date by hand results in an error with python2.4

Reported by: gleb@… Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords: setuptools, dependencies, python2.4
Cc: Trac Release: 0.11

Description (last modified by rjollos)

I think strptime has a different location in 2.5 vs 2.4. I'm using centos 5 and python24

File "/usr/lib/python2.4/site-packages/Trac-0.12.3-py2.4.egg/trac/web/main.py", line 522, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/Trac-0.12.3-py2.4.egg/trac/web/main.py", line 243, in dispatch
  resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/timingandestimationplugin/webui.py", line 119, in process_request
  self.set_bill_date(req.authname, req.args.get('newbilltime'))
File "build/bdist.linux-i686/egg/timingandestimationplugin/webui.py", line 63, in set_bill_date
  when = parsetime(when, now.tzinfo)
File "build/bdist.linux-i686/egg/timingandestimationplugin/webui.py", line 49, in parsetime
  try: return datetime.datetime.strptime(val, f).replace(tzinfo=tzinfo)

Attachments (0)

Change History (16)

comment:1 Changed 3 years ago by rjollos

  • Description modified (diff)

comment:2 Changed 3 years ago by bobbysmith007

  • Keywords waiting-for-feedback added

Is it necessary to fix this? Python 2.5 has been released for over 5 years. I am not opposed to applying patches that make the plugin more compatible with more versions of things, but I don't want to spend time squashing random bugs to maintain backwards compatibility with old software. (Especially since I don't have a box I can easily test against python2.4, I would have to reconstitute a python / trac env from a while ago, just to start debugging this). I have updated the python version number on the wiki page for this project to reflect python 2.5 as the lowest version number (though if patches are forthcoming I can revise that)..

Is there any reason a newer python cannot be installed?

comment:3 Changed 3 years ago by bobbysmith007

see also #9612

comment:4 Changed 3 years ago by gleb@…

  • Keywords waiting-for-feedback removed

We're using CentOS 5.6 (released last year) which comes with python2.4. It's also the latest of the rightscale ami instances on ec2.

At the same time, it's fine if python2.4 is not supported, but it would be helpful if the installer could let people know that this python version is not supported. I can fix the error myself, but not sure if there is more and it's scary to uninstall the plugin...

BTW, version 0.12 doesn't compile on python2.4

comment:5 Changed 3 years ago by bobbysmith007

(In [11274]) Add minimum version check to setup.py scripts re #9793

comment:6 Changed 3 years ago by bobbysmith007

Good to know, and that does provide some motivation to support this. Please do provide any patches you make (at least as reference for others facing the same situation, or myself if I go to fix this).

  • When you say version 0.12 I assume you mean the branch of this plugin that works with trac 0.12 ?
  • If you care to elaborate on "it's scary to uninstall the plugin" I might be able to help. I dont know of any cases where it would cause problems once uninstalled. (It should mostly be about removing the configuration in trac.ini and removing the built / installed packages from your python site-packages / dist-packages directory. (That said I have only even attempted uninstalls when trying to help others.)
  • As a note my ubuntu development server (11.10) does not include python2.4 as an installable package. (Though I'm sure I can add a backport or something if it became necessary).

comment:7 Changed 3 years ago by rjollos

I don't know if you were trying to accomplish something more elaborate, but adding the line install_requires = [ 'Python >= 2.4' ] might accomplish the same thing (e.g. DateFieldPlugin's setup.py). I've used this to help prevent issues such as a user installing the wrong plugin / Trac combination. I may have the syntax wrong, but you can do something like install_requires = [ '0.11 <= Trac < 0.12' ].

Anyway, if you already knew that, sorry for butting in ;)

comment:8 follow-ups: Changed 3 years ago by bobbysmith007

rjollos: I appreciate it, I had actually just copied that line from the top of trac's own setup.py assuming they would be doing it the nominally "correct" way. I had figured setup would have that built in, but then saw the trac setup and just blindly followed what it was doing.

I tried switching it around and it seemed to behave ... oddly. It also automatically downloaded and installed trac and dependencies (rather than signalling that the user didnt have prerequisites (or prompting to do the download)).

I don't understand why this occurred, when I changed it to the setup.py install_requires, perhaps it can be ignored, but without understanding it further I am reticent to commit it.

Searching for Python==2.6
Best match: Python 2.6
Adding Python 2.6 to easy-install.pth file

comment:9 in reply to: ↑ 8 ; follow-up: Changed 3 years ago by rjollos

Replying to bobbysmith007:

I tried switching it around and it seemed to behave ... oddly. It also automatically downloaded and installed trac and dependencies (rather than signalling that the user didnt have prerequisites (or prompting to do the download)).

Yeah, I've seen the auto-download behavior as well. I'm not sure what the best practice is (which is why I felt like commenting on this ticket ... I figure correctly that you'd have some interesting comments ;)

hasienda and I have been talking about putting together a wiki page of best practices for plugin development. This seems like an important item to research and add a section for.

comment:10 in reply to: ↑ 9 Changed 3 years ago by bobbysmith007

Replying to rjollos:

Yeah, I've seen the auto-download behavior as well. I'm not sure what the best practice is (which is why I felt like commenting on this ticket ... I figure correctly that you'd have some interesting comments ;)

I got the impression that if I spent another hour reading the docs, that there was probably a way to configure that behavior either through setup.cfg or by using different keys in setup.py. I have a coworker who has dealt with that stuff more than I and might be able to provide some insight tomorrow.

hasienda and I have been talking about putting together a wiki page of best practices for plugin development. This seems like an important item to research and add a section for.

Please do and also send a link to the mailing list. I think that sort of page could be very useful and help people avoid common mistakes. I would be happy to contribute what I can.

comment:11 Changed 3 years ago by rjollos

We might want to track #9800 and see what comments osimons has on a similar issue.

comment:12 in reply to: ↑ 8 Changed 3 years ago by rjollos

  • Keywords setuptools dependencies python2.4 added

Replying to bobbysmith007:

I don't understand why this occurred, when I changed it to the setup.py install_requires, perhaps it can be ignored, but without understanding it further I am reticent to commit it.

#9589 describes similar problems using install_requires.

comment:13 Changed 3 years ago by bobbysmith007

#9844 is also complaining about the centOS / py2.4 problem. I think I will attempt to just apply a fix for that soon, so that everyone can just get this working easier.

comment:14 Changed 2 years ago by bobbysmith007

(In [11383]) T&E Bug fixes

  • remove python version requirements
  • fix date parsing (again)
  • fix db_table_exists (again)

re #9612 and #9793 and #9844 and #9901

comment:15 Changed 2 years ago by bobbysmith007

(In [11384]) T&E Bug fixes (version 1.2.7)

  • Enforce customizable permission on the billing/management page
  • remove python version requirements
  • fix date parsing (again)
  • fix db_table_exists (again)

re #9612 and #9793 and #9844 and #9901

comment:16 Changed 2 years ago by bobbysmith007

  • Resolution set to fixed
  • Status changed from new to closed

It seemed like there was a value in attempting to get this to run in python 2.4. I have made an attempt at changing the code so that it should work in 2.4 on.

I cant easily run 2.4 , but I have replaced the offending function, so it should hopefully work. Please report any bugs you might find.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.