Gustavo Picon is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

tabo / django-treebeard

Efficient tree implementations for Django 1.0+ :: https://tabo.pe/projects/django-treebeard/

Clone this repository (size: 602.0 KB): HTTPS / SSH
hg clone https://bitbucket.org/tabo/django-treebeard
hg clone ssh://hg@bitbucket.org/tabo/django-treebeard

Issues

#12 Index error on subclassing from MP_Node

Reported anonymously (last edited )

Using Python 2.6, Django 1.1, Treebeard 1.52, MySQL 5.1.42-community, winXP.

Not sure if this is a django problem or treebeard.

Loading the following code get IndexError:

try:

    from django.db import models, transaction

    from django.db.models import AutoField

    import django.dispatch

    from treebeard.mp_tree import MP_Node

except ImportError, exc:

    print "django error in %s: %s" % (__file__, exc)


class DelibNode(MP_Node): pass
Traceback (most recent call last):

     File "<console>", line 1, in <module>

     File "C:\Program Files\Python26\lib\site-packages\django
\db\models\base.py", line 52, in __new__

     kwargs = {"app_label": 
model_module.__name__.split('.')[-2]}

     IndexError: list index out of range

Installed apps in setting.py:

INSTALLED_APPS = (  

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.sites',

'django.contrib.admin',

'django.contrib.treebeard',

'medCE.delib' )

Workaround: Changed code in django/db/models/base.py:

##        if getattr(meta, 'app_label', None) is None:  

##            model_module = sys.modules[new_class.__module__]


##            try:

##                one_up = model_module.__name__.split('.')[-2]

##            except IndexError:

##                one_up = "treebeard"

##            kwargs = {"app_label": one_up}

##        else:

##            kwargs = {}
Status: invalid Responsible: nobody Type: bug Priority: major
Milestone: none Component: none Version: none

Attachments

No attachments added for this issue yet.

Comments and changes

  1. #1 Gustavo Picon

    written

    • Changed content.
  2. #2 Gustavo Picon

    written

    • Changed content.
  3. #3 Gustavo Picon

    written

    • Changed status from new to invalid.

    Uh that error has nothing to do with treebeard.

    And why do you have treebeard in django.contrib?

    Closing as invalid.

Add comment / attachment

Show/hide preview

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?