please modify a little to support jython #198

Open
sinojelly opened this Issue Nov 12, 2011 · 5 comments

Projects

None yet

5 participants

@sinojelly

The latest jython release version is 2.5.2, does not support some features in python 2.6, such as str.format .

When i was porting lettuce to jython, i found str.format occur once.
Luckly, after having modified it, lettuce worked well in jython.

Run lettuce in jython is very usefull when you use it to test some java projects, such as android.

@sridwan
sridwan commented Feb 6, 2012

same here.
I was gonna port my project to jython, but I used a lot of str.format.
I search in jython docs str.format is available. Strange...

@gabrielfalcao
Owner

Lettuce is rather focused on providing support to newer versions of python (aka python 3) so I'm putting this in low priority

@adaschevici
Collaborator

I checked this one out.
It seems there are a lot of places where the code uses the format function so the changes are not too easy to make without breaking stuff.
I have 2 ideas:
one is using conditional formatting based on version - > but this would be kind of ugly
another is using a custom format function and place it inside a compatibility package say compatibility that would be documented on each function and marked as a must read - > not ok for future reference

Do you have any hints on this?

@adaschevici
Collaborator

I have also looked into another solution using the module here:
https://github.com/clarete/forbiddenfruit/tree/ad1d68d5c41b26ace64cb81f971dd6e29ca3b658
But this would not work under jython unfortunately because of the lack of a c python api.

However i would suggest closing this once jython upgrades version( currently 2.7.1b)

@danni
Collaborator
danni commented Jan 21, 2014

Could replace uses of format with a % string substitution. Even one that takes a dict, i.e.

"%(address)s:%(port)" % ({address: ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment