#15066: Pymongo breaks displayhook _graphics_()
------------------------+-----------------------------
   Reporter:  vbraun    |            Owner:
       Type:  defect    |           Status:  new
   Priority:  major     |        Milestone:  sage-5.12
  Component:  graphics  |         Keywords:
  Merged in:            |          Authors:
  Reviewers:            |  Report Upstream:  N/A
Work issues:            |           Branch:
     Commit:            |     Dependencies:  #14469
   Stopgaps:            |
------------------------+-----------------------------
 Apparently pymongo uses a getattr hack that claims to have all and every
 method implemented, and then fails flat on its face when you actually try.
 This breaks the new displayhook.

 Note that this error will just appear if you (implicitly) call the
 displayhook. Pymongo is working just fine, only the implicit printing is
 broken:
 {{{
 sage: import pymongo
 sage: c = pymongo.Connection()
 sage: c.__repr__()
 "Connection('localhost', 27017)"
 sage: c
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-4-2cd6ee2c70b0> in <module>()
 ----> 1 c

 /home/vbraun/opt/sage-5.12.beta0/local/lib/python2.7/site-
 packages/IPython/core/displayhook.pyc in __call__(self, result)
     236             self.start_displayhook()
     237             self.write_output_prompt()
 --> 238             format_dict = self.compute_format_data(result)
     239             self.write_format_data(format_dict)
     240             self.update_user_ns(result)

 /home/vbraun/opt/sage-5.12.beta0/local/lib/python2.7/site-
 packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
     148             MIME type representation of the object.
     149         """
 --> 150         return self.shell.display_formatter.format(result)
     151
     152     def write_format_data(self, format_dict):

 /home/vbraun/opt/sage-5.12.beta0/local/lib/python2.7/site-
 packages/IPython/core/formatters.pyc in format(self, obj, include,
 exclude)
     124                     continue
     125             try:
 --> 126                 data = formatter(obj)
     127             except:
     128                 # FIXME: log the exception

 /home/vbraun/opt/sage-5.12.beta0/local/lib/python2.7/site-
 packages/sage/misc/displayhook.pyc in __call__(self, obj)
     310         """
     311         if hasattr(obj, '_graphics_') and not isinstance(obj,
 type):
 --> 312             if obj._graphics_():
     313                 return ''
     314         s = self._format_obj(obj)

 /home/vbraun/opt/sage-5.12.beta0/local/lib/python2.7/site-
 packages/pymongo-2.6-py2.7-linux-x86_64.egg/pymongo/database.pyc in
 __call__(self, *args, **kwargs)
     811                         "call the '%s' method on a '%s' object it
 is "
     812                         "failing because no such method exists." %
 (
 --> 813                             self.__name,
 self.__connection.__class__.__name__))
     814
     815

 TypeError: 'Database' object is not callable. If you meant to call the
 '_graphics_' method on a 'Connection' object it is failing because no such
 method exists.
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15066>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to