maximum recursion depth exceeded

46 views
Skip to first unread message

Denis Rykov

unread,
May 9, 2012, 2:08:45 PM5/9/12
to forma...@googlegroups.com
I have 2 models:

class Bird(Base):
    __tablename__ = 'bird'
    __label__ = _(u"Вид")
    __plural__ = _(u"Виды")
    id = Column(Integer, primary_key=True, label=_(u"Номер записи"))
    name_lat = Column(Unicode, unique=True, label=_(u"Латинское название"))
    name_rus = Column(Unicode, label=_(u"Русское название"))

    def __unicode__(self):
        return u'%s (%s)' % (self.name_lat, self.name_rus)

class Report(Base):
   ...
   bird = relationship(Bird, backref=backref('child', uselist=True), uselist=False)


When I try to perfom sorting records in jqgrid (fa.jquery) by bird column of Report model I get an error: RuntimeError: maximum recursion depth exceeded. How I can fix this?

Gaël Pasgrimaud

unread,
May 9, 2012, 3:36:36 PM5/9/12
to forma...@googlegroups.com
No idea. Try to give the full traceback.
> --
> You received this message because you are subscribed to the Google Groups
> "FormAlchemy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/formalchemy/-/_0Kut8T31ooJ.
> To post to this group, send email to forma...@googlegroups.com.
> To unsubscribe from this group, send email to
> formalchemy...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/formalchemy?hl=en.

Denis Rykov

unread,
May 9, 2012, 9:37:50 PM5/9/12
to forma...@googlegroups.com
I've posted full traceback here:  https://gist.github.com/2650327

Gaël Pasgrimaud

unread,
May 10, 2012, 1:17:18 AM5/10/12
to forma...@googlegroups.com
You should try to use pdb to see what collection, sidx and sord are at
this line:

collection.order_by(getattr(sidx, sord)())

I guess it's Report.order_by(Report.bird.asc())

But I have no idea why this fail. We are not able to sort on User's
Group on the demo: http://docs.formalchemy.org/demo/admin/User but
there is no traceback.

On Thu, May 10, 2012 at 3:37 AM, Denis Rykov <ryk...@gmail.com> wrote:
> I've posted full traceback here:  https://gist.github.com/2650327
>
> --
> You received this message because you are subscribed to the Google Groups
> "FormAlchemy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/formalchemy/-/tZH3eLoLXfYJ.

Denis Rykov

unread,
May 10, 2012, 4:54:16 AM5/10/12
to forma...@googlegroups.com
Using pdb I've got the following results:

(Pdb) print sord
desc
(Pdb) print sidx
Report.bird
(Pdb) getattr(sidx, sord)()
*** RuntimeError: maximum recursion depth exceeded

Gaël Pasgrimaud

unread,
May 10, 2012, 5:16:05 AM5/10/12
to forma...@googlegroups.com
Dont know how to solve that.. But it's mostly a sqlalchemy problem. I
suspect that you cant sort on a relation with uselist=True.

You should ask your question on SA's list. "How to sort on my relation field?"

If you got a solution but this one require a fix in formalchemy i'll fix it.
> --
> You received this message because you are subscribed to the Google Groups
> "FormAlchemy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/formalchemy/-/EjRFRTAbVYoJ.
Reply all
Reply to author
Forward
0 new messages