openstax / openstax-cms

The OpenStax CMS, built using Wagtail on top of Django.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Salesforce Initialization Error

rich-hart opened this issue · comments

Python 3.4 on Ubuntu 15.04 does not like how the subclass is referencing simple_salesforce methods. I've ran this same test on in python 3.5 on OS X 10.11and it passes.

Creating test database for alias 'default'...
E
======================================================================
ERROR: test_faculty_rejected (accounts.tests.SalesforceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/development/openstax-cms/accounts/tests.py", line 111, in test_faculty_rejected
    status = sf.faculty_status(3)
  File "/home/vagrant/development/openstax-cms/accounts/salesforce.py", line 32, in faculty_status
    contact_info = self.query(sql_command)
  File "/home/vagrant/development/venv/lib/python3.4/site-packages/simple_salesforce/api.py", line 278, in query
    url = self.base_url + 'query/'
  File "/home/vagrant/development/venv/lib/python3.4/site-packages/simple_salesforce/api.py", line 167, in __getattr__
    return SFType(name, self.session_id, self.sf_instance, self.sf_version, self.proxies)

            *
            *
            *

  File "/home/vagrant/development/venv/lib/python3.4/site-packages/simple_salesforce/api.py", line 167, in __getattr__
    return SFType(name, self.session_id, self.sf_instance, self.sf_version, self.proxies)
RuntimeError: maximum recursion depth exceeded while calling a Python object

----------------------------------------------------------------------
Ran 1 test in 0.509s

FAILED (errors=1)
Destroying test database for alias 'default'...

Look's like all it needed was some better error handling. This was a problem with how the accounts.salesforce.Salesforce class handled errors when settings.SALESFORCE attribute was missing. Using try ... exempt ... without citing an exception type was too general and confused the interpreter. Seems to only be a issue with Ubuntu's version of python.