Changeset 624 for trunk/zoo-project/zoo-kernel/service_internal_python.c
- Timestamp:
- Apr 10, 2015, 8:02:04 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_python.c
r623 r624 551 551 free(cursor->content); 552 552 free(cursor); 553 Py_DECREF(key);554 553 #ifdef DEBUG 555 554 dumpMaps(res); … … 643 642 PyObject* confdict; 644 643 int istatus; 645 char* status ;644 char* status=NULL; 646 645 if (!PyArg_ParseTuple(args, "O!i", &PyDict_Type, &confdict, &istatus)){ 647 646 #ifdef DEBUG 648 647 fprintf(stderr,"Incorrect arguments to update status function"); 649 648 #endif 650 return NULL;649 Py_RETURN_NONE; 651 650 } 652 651 if (istatus < 0 || istatus > 100){ 653 652 PyErr_SetString(ZooError, "Status must be a percentage."); 654 return NULL;653 Py_RETURN_NONE; 655 654 }else{ 656 655 char tmpStatus[4]; … … 658 657 status = zStrdup(tmpStatus); 659 658 } 660 /* now update the map */ 661 { 662 PyObject* lenv = PyMapping_GetItemString(confdict, (char *)"lenv"); 663 if (lenv && PyMapping_Check(lenv)){ 664 PyObject* valobj = PyString_FromString(status); 665 PyMapping_SetItemString(lenv, (char *)"status", valobj); 666 Py_DECREF(valobj); 667 } 668 Py_DECREF(lenv); 669 } 659 // create a local copy and update the lenv map 670 660 conf = mapsFromPyDict((PyDictObject*)confdict); 671 if (getMapFromMaps(conf,"lenv","status") != NULL){ 672 if(status!=NULL){ 673 setMapInMaps(conf,"lenv","status",status); 674 free(status); 675 } 676 else 677 setMapInMaps(conf,"lenv","status","15"); 678 _updateStatus(conf); 679 } 661 if(status!=NULL){ 662 setMapInMaps(conf,"lenv","status",status); 663 free(status); 664 } 665 else 666 setMapInMaps(conf,"lenv","status","15"); 667 _updateStatus(conf); 680 668 freeMaps(&conf); 681 669 free(conf);
Note: See TracChangeset
for help on using the changeset viewer.