Changeset 50225a in git


Ignore:
Timestamp:
Jun 14, 2005, 11:30:00 AM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
9a95b3a11b46e9041db2db3dc586e8863e9fed9e
Parents:
68549dc733f8a9d1cd0d177bb2117ea043673222
Message:
*bricken: having fun


git-svn-id: file:///usr/local/Singular/svn/trunk@8359 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
modules/openmathserver
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • modules/openmathserver/context.py

    r68549d r50225a  
     1from exceptions import *
    12from copy import copy
    23from cd import *
  • modules/openmathserver/objects.py

    r68549d r50225a  
    11from omexceptions import *
     2from exceptions import *
    23from cd import *
     4
    35class OMobject(object):
    46    def __init__(self):
    57        self.attributes={}
    6     pass
     8    def __getChildren(self):
     9        try:
     10            return self.getChildren()
     11        except AttributeError:
     12            try:
     13                return self.children
     14            except AttributeError:
     15                return []
     16    def __delChildren(self):
     17        try:
     18            self.delChildren()
     19            return
     20        except AttributeError:
     21            try:
     22                del self.children
     23            except AttributeError:
     24                pass
     25    def __setChildren(self,children):
     26        try:
     27            self.setChildren(children)
     28        except AttributeError:
     29                self.children=children
     30    def __getBody(self):
     31        try:
     32            return self.getBody()
     33        except AttributeError:
     34            try:
     35                return self.body
     36            except AttributeError:
     37                return None
     38    def __delBody(self):
     39        try:
     40            self.delBody()
     41            return
     42        except AttributeError:
     43            try:
     44                del self.body
     45            except AttributeError:
     46                pass
     47    def __setBody(self,body):
     48        try:
     49            self.setBody(body)
     50        except AttributeError:
     51                self.body=body
     52    children=property(__getChildren, __setChildren,__delChildren,\
     53                      """ children in an OMtree""")
     54    body=property(__getBody,__setBody,__delBody,\
     55        "xml body,FIXME: at the moment only char data")
     56    def XMLencode(self, context):
     57        try:
     58            attr=self.XMLAttributes()
     59            attrstr=" ".join([a.encode(context) for a in attr])
     60        except:
     61            attrstr=""
     62        opening="".join(["<", self.xmltag, " ", attrstr,">"])
     63        children=self.children
     64        if children:
     65            body="".join([c.XMLencode(context) for i in children])
     66        else:
     67            body=self.body
     68            if not body:
     69                body=""
     70            body=context.xmlEncodeBody(body)
     71        closing="".join(["</"+self.xmltag+">"])
     72        return "".join([opening,body,closing])
    773class OMvar(OMobject):
    874    def __init__(self,name):
     
    66132    def __str__(self):
    67133        return "OMint("+repr(self.value)+")"
    68    
    69 
     134    def getBody(self):
     135        return str(self.value)
     136    def setBody(self, value):
     137        raise OperationNotPossibleError
    70138class OMfloat(SimpleValue):
    71139    def __init__(self,value):
     
    112180   
    113181    print context.evaluate(application)
    114    
     182    i=OMint(22482489)
     183    print i.body
     184    i.body="dshj"
    115185   
  • modules/openmathserver/omexceptions.py

    r68549d r50225a  
    11class OutOfScopeError(Exception):
    22    pass
    3 class NotImplementedError(Exception):
    4     pass
     3#class NotImplementedError(Exception):
     4#    pass
    55class EvaluationFailedError(Exception):
    66    pass
    77class PackagingFailedError(Exception):
    88    pass
     9class OperationNotPossibleError(Exception):
     10    pass
Note: See TracChangeset for help on using the changeset viewer.