Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#3708 closed (invalid)

possible incompatibility with edit inline and python 2.5.1rc1

Reported by: mcallister.sean@… Owned by: Jacob
Component: Uncategorized Version: master
Severity: Keywords: filepathfield python2.5
Cc: eric@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I've noticed a problem with python 2.5 and one of my models. It might be that this is caused by my distributions (Ubuntu Feisty) python packages, as they seem a little flaky to say the least. Using python 2.4 the problem is not there.
I stripped the problem down to this little test model:

from django.db import models

class Media(models.Model):
    signature = models.CharField(unique=True, maxlength=100)
    note = models.TextField(null=True, blank=True)

    class Admin:
        pass
    def __str__(self):
        return "%s" %(self.signature)

class File(models.Model):
    files_path = models.FilePathField(path="/path/to/files/", recursive=True, core=True)
    files_medium = models.ForeignKey("Media", edit_inline=models.STACKED, num_in_admin=1, max_num_in_admin=1)
    
    def __str__(self):
	return self.files_path
    
    def save(self):
	print "DEBUG::::preparing to save file with path: %s" %(self.files_path)
	super(File,self).save()

The problem is with the files_path, which is stripped down to '/' with python 2.5, as can be seen in the debug line. Python 2.4 gets the whole path '/path/to/files/file.txt'.

Change History (7)

comment:1 Changed 10 years ago by Chris Beaven

Can we have a confirmation from someone else please?

comment:2 in reply to:  1 Changed 10 years ago by vidarl@…

Replying to SmileyChris:

Can we have a confirmation from someone else please?

This is true for Ubuntu Feistys python2.5 packages.

comment:3 Changed 10 years ago by Chris Beaven

Triage Stage: UnreviewedAccepted

Thanks for the initial report and confirmation.

comment:4 Changed 10 years ago by chris.vigelius@…

Summary: possible incompatibility with edit inline and python 2.5possible incompatibility with edit inline and python 2.5.1rc1

This problem appears only with Python 2.5.1rc1 (used in feisty), see http://python.org/sf/1615701 and https://bugs.launchpad.net/ubuntu/+source/python2.5/+bug/107525 (the launchpad bug already contains a patch to fix the broken package).

comment:5 in reply to:  4 Changed 10 years ago by chris.vigelius@…

Replying to chris.vigelius@gmx.net:

This problem appears only with Python 2.5.1rc1 (used in feisty), see http://python.org/sf/1615701 and https://bugs.launchpad.net/ubuntu/+source/python2.5/+bug/107525 (the launchpad bug already contains a patch to fix the broken package).

Notice: the aforementioned fix also solves a problem with the tutorial, described in http://groups.google.com/group/django-users/browse_thread/thread/876ff670527a1896

comment:6 Changed 10 years ago by Chris Beaven

Resolution: invalid
Status: newclosed

Thanks for the clarification, Chris. In that case, there's nothing we need to do about it.

comment:7 Changed 10 years ago by eric@…

Cc: eric@… added

Here's what I did as a temporary fix (until the Ubuntu team updates the Python2.5 package to use 2.5.1-final):

Fix broken Python 2.5.1 rc1 in Ubuntu Feisty

See also:

Overview:

  1. Install apt-build to help rebuild the Python2.5 ubuntu package with the latest Python source
  2. Download the latest Python source in a location where apt-build will find it
  3. Have apt-build rebuild the Python2.5 package with the new source
  4. Install the newly compiled Python2.5 package

Install apt-build

sudo apt-get update
sudo apt-get install apt-build

Answer the apt questions thusly:

# In order to install built package via APT, you must add a line like this to
# your sources.list:
# deb file:/var/cache/apt-build/repository apt-build main
# Add apt-build repository to sources.list?
# answer 'Yes'

# If your architecture is not here, choose one and edit your configuration
# file (/etc/apt/apt-build.conf) by hand, and please do a wishlist bugreport.
#
# Find out what architecture you have with:
# cat /proc/cpuinfo 
#processor       : 0
#vendor_id       : GenuineIntel
#model name      : Pentium III (Coppermine)
#
# Select 'Pentium3'

Upate the package list again

sudo apt-get update
sudo apt-build update

Rebuild and install Python 2.5.1-final

# This is where apt-build puts its source files
cd /var/cache/apt-build/build

# Download Python 2.5.1 final
sudo wget http://www.python.org/ftp/python/2.5.1/
sudo tar xzf Python-2.5.1.tgz

# If you already have the Feisty 2.5.1-rc1 source, move it aside
sudo mv python2.5-2.5.1~rc1  python2.5-2.5.1~rc1.old

# Make apt-build think that the 2.5.1-final source is the old source
sudo ln -s Python-2.5.1 python2.5-2.5.1~rc1

# ... but to do that we have to copy the Debian folder to the final source
cd python2.5-2.5.1~rc1.old
sudo cp -a debian ../python2.5-2.5.1~rc1
cd ../

# Rebuild and install Python2.5 with the 2.5.1-final source:
sudo apt-build install --reinstall python2.5

# I had to do one final upgrade to get the newly compiled (unauthenticated) packages to install
sudo apt-get upgrade
Note: See TracTickets for help on using tickets.
Back to Top