Django system check gives error when storing method in variable

92 views
Skip to first unread message

Wouter Miltenburg

unread,
Mar 29, 2015, 12:01:04 PM3/29/15
to django...@googlegroups.com
Hi all,

Haven't used Django 1.7.7 till today, but whenever I want to launch my
project I get the following error:
ERRORS:
gopro.MyPayment: (models.E020) The 'MyPayment.check()' class method is
currently overridden by <function MollieIdealPayment.is_paid at
0x7f0716731b90>.

I use another django app
(https://github.com/wmiltenburg/django-mollie-ideal) inside the app that
I am currently writing. The problem seems to be relating to line 75 in
models.py
(https://github.com/wmiltenburg/django-mollie-ideal/blob/master/mollie/ideal/models.py,
check = is_paid), where is_paid is a method. If I comment it out it
works fine. However, this used to work in previous Django releases (1.6)
and it is valid Python code. In Django 1.7 it shows the following error:
TypeError: is_paid() missing 1 required positional argument: 'self'.

The error shows up when Django performs the system checks. My guess is
that the "system check" from Django 1.7 doesn't handle function
referencing in Python well (which used to be in Django 1.6). However, I
am wondering if this is a more of a general problem in Django itself and
if other users experience the same problem.

Cheers,
Wouter.

Markus Holtermann

unread,
Mar 29, 2015, 12:06:10 PM3/29/15
to django...@googlegroups.com
Hey Wouter,

since Django 1.7 Model.check() is a reserved method that is used by the system checks framework (https://docs.djangoproject.com/en/1.7/topics/checks/#field-model-and-manager-checks). The cleanest way is to remove that line (check = is_paid). Why do you have that in the first place?

/Markus

Wouter Miltenburg

unread,
Mar 29, 2015, 12:33:10 PM3/29/15
to django...@googlegroups.com
Hi Markus,

That explains it :), will change the code.

Not really sure why that line is there to be honest. The original version of that code was developed by someone else and this is just the version that is compatible with Python 3. Don't really see dependencies in the code itself that uses the 'check' method, so it shouldn't be a real problem to remove that line. However, as I am not the original author of that code I am not aware of the user-base that might have dependencies with this method.

Thank you for your quick response.

Cheers,
Wouter.

Op zondag 29 maart 2015 18:06:10 UTC+2 schreef Markus Holtermann:
Reply all
Reply to author
Forward
0 new messages