is_rpcmethod problems with mongodb

Bug #570852 reported by davidfischer
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I discovered a bug in rpc4django while trying to get it work on our system. The problem is the check whether a function is callable via rpc or not ( line 236, 237).
                if callable(method) and \
                   getattr(method, 'is_rpcmethod', False):

We use mongodb as our database and our database object is called mongodb. In this case mongodb.is_rpcmethod is a mongo collection and is callable and will be registered. This will cause some nasty errors later.

A typecheck on is_rpcmethod fixes this problem:
                if callable(method) and \
                   getattr(method, 'is_rpcmethod', False) and \
                   isinstance(getattr(method, 'is_rpcmethod', False), types.BooleanType):

Kind regards,

davidfischer (djfische)
Changed in rpc4django:
importance: Undecided → Medium
assignee: nobody → davidfischer (djfische)
milestone: none → 0.1.8
davidfischer (djfische)
Changed in rpc4django:
status: New → Fix Committed
davidfischer (djfische)
Changed in rpc4django:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers