Changeset 808
- Timestamp:
- Oct 29, 2007 1:16:24 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/Rappture/PyRpLibrary.cc
r795 r808 95 95 int retVal = 1; 96 96 97 if (!PyArg_ParseTuple(args, " O", &inObj)) {97 if (!PyArg_ParseTuple(args, "|O", &inObj)) { 98 98 PyErr_Format(PyExc_TypeError, 99 "library() takes 1 argument, a file name or a Rappture Library Object");99 "library() takes at most 1 argument, a file name or a Rappture Library Object"); 100 100 return -1; 101 101 } 102 102 103 if (PyString_Check(inObj)) { 104 filename = PyString_AsString(inObj); 105 if (filename == NULL) { 106 PyErr_Format(PyExc_ValueError,"a file name is required"); 107 } 108 self->lib = new RpLibrary(std::string(filename)); 109 } 110 else if (RpLibraryObject_IsValid(inObj)) { 111 self->lib = new RpLibrary( *(RpLibraryObject_AsLibrary(inObj)) ); 112 } 113 else if (RpLibraryObject_Check(inObj)) { 103 if (inObj != NULL) { 104 if (PyString_Check(inObj)) { 105 filename = PyString_AsString(inObj); 106 if (filename == NULL) { 107 PyErr_Format(PyExc_ValueError,"a file name is required"); 108 } 109 self->lib = new RpLibrary(std::string(filename)); 110 } 111 else if (RpLibraryObject_IsValid(inObj)) { 112 self->lib = new RpLibrary( *(RpLibraryObject_AsLibrary(inObj)) ); 113 } 114 else if (RpLibraryObject_Check(inObj)) { 115 self->lib = new RpLibrary(); 116 } 117 else { 118 PyErr_Format(PyExc_TypeError,"unrecognized object type"); 119 return -1; 120 } 121 } 122 else { 114 123 self->lib = new RpLibrary(); 115 }116 else {117 PyErr_Format(PyExc_TypeError,"unrecognized object type");118 return -1;119 124 } 120 125 -
trunk/src/core/RpLibrary.cc
r788 r808 100 100 else { 101 101 // create a new xml (from an empty file) 102 freeTree = 1; 103 tree = scew_tree_create(); 104 root = scew_tree_add_root(tree, "run"); 102 105 } 103 106 }
Note: See TracChangeset
for help on using the changeset viewer.