Changeset 50225a in git
- Timestamp:
- Jun 14, 2005, 11:30:00 AM (18 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- 9a95b3a11b46e9041db2db3dc586e8863e9fed9e
- Parents:
- 68549dc733f8a9d1cd0d177bb2117ea043673222
- Location:
- modules/openmathserver
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/openmathserver/context.py
r68549d r50225a 1 from exceptions import * 1 2 from copy import copy 2 3 from cd import * -
modules/openmathserver/objects.py
r68549d r50225a 1 1 from omexceptions import * 2 from exceptions import * 2 3 from cd import * 4 3 5 class OMobject(object): 4 6 def __init__(self): 5 7 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]) 7 73 class OMvar(OMobject): 8 74 def __init__(self,name): … … 66 132 def __str__(self): 67 133 return "OMint("+repr(self.value)+")" 68 69 134 def getBody(self): 135 return str(self.value) 136 def setBody(self, value): 137 raise OperationNotPossibleError 70 138 class OMfloat(SimpleValue): 71 139 def __init__(self,value): … … 112 180 113 181 print context.evaluate(application) 114 182 i=OMint(22482489) 183 print i.body 184 i.body="dshj" 115 185 -
modules/openmathserver/omexceptions.py
r68549d r50225a 1 1 class OutOfScopeError(Exception): 2 2 pass 3 class NotImplementedError(Exception):4 pass3 #class NotImplementedError(Exception): 4 # pass 5 5 class EvaluationFailedError(Exception): 6 6 pass 7 7 class PackagingFailedError(Exception): 8 8 pass 9 class OperationNotPossibleError(Exception): 10 pass
Note: See TracChangeset
for help on using the changeset viewer.