#12205: rewrite conway polynomial spkg and code in Sage library to not use ZODB
-----------------------------+----------------------------------------------
       Reporter:  was        |         Owner:  was     
           Type:  task       |        Status:  new     
       Priority:  major      |     Milestone:  sage-5.6
      Component:  databases  |    Resolution:          
       Keywords:             |   Work issues:          
Report Upstream:  N/A        |     Reviewers:          
        Authors:             |     Merged in:          
   Dependencies:             |      Stopgaps:          
-----------------------------+----------------------------------------------

Comment (by fbissey):

 In the end I am hitting a brick wall here. Possibly due to my lack of
 python skills and my will to only have minimal changes in conway.py. The
 issue is that the created sobj is a double dictionary and that the call to
 the !ConwayPolynomials() class follow the same pattern as a double
 dictionary. You have calls of the kind:
 !ConwayPolynomials()[3][21]

 Implementing the class as a dictionary allows sage to start
 {{{
 import os

 from sage.structure.sage_object import load
 from sage.misc.misc import SAGE_DATA

 _CONWAYDATA = os.path.join(SAGE_DATA,'conway_polynomials')

 class ConwayPolynomials(dict):
     def __init__(self,*arg,**kw):
         """
         Initialize the database.
         """
         super(ConwayPolynomials, self).__init__(*arg, **kw)

     def _init(self):
         if not os.path.exists(_CONWAYDATA):
             raise RuntimeError, "In order to initialize the database, the
 directory must exist."%_CONWAYDATA
         os.chdir(_CONWAYDATA)
         self = load(os.path.join(_CONWAYDATA, 'conway_polynomials'))
 }}}
 but unfortunately but I get key errors:
 {{{
 sage: sage.databases.conway.ConwayPolynomials()[3][21]
 ---------------------------------------------------------------------------
 KeyError                                  Traceback (most recent call
 last)

 /home/fbissey/Work/Overlays/BlueFern/sci-mathematics/sage/<ipython
 console> in <module>()

 KeyError: 3
 sage: sage.databases.conway.ConwayPolynomials().keys()
 []
 }}}
  I was hoping that inheriting the dict class the access problem would be
 solved but I am obviously doing something wrong here. Loading the sobj
 directly from sage is totally usable, it is just when trying to put it in
 a class.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12205#comment:11>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to