Ignore:
Timestamp:
Apr 10, 2015, 8:02:04 PM (10 years ago)
Author:
djay
Message:

Fix for python support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal_python.c

    r623 r624  
    551551    free(cursor->content);
    552552    free(cursor);
    553     Py_DECREF(key);
    554553#ifdef DEBUG
    555554    dumpMaps(res);
     
    643642  PyObject* confdict;
    644643  int istatus;
    645   char* status;
     644  char* status=NULL;
    646645  if (!PyArg_ParseTuple(args, "O!i", &PyDict_Type, &confdict, &istatus)){
    647646#ifdef DEBUG
    648647    fprintf(stderr,"Incorrect arguments to update status function");
    649648#endif
    650     return NULL;
     649    Py_RETURN_NONE;
    651650  }
    652651  if (istatus < 0 || istatus > 100){
    653652     PyErr_SetString(ZooError, "Status must be a percentage.");
    654      return NULL;
     653     Py_RETURN_NONE;
    655654  }else{
    656655     char tmpStatus[4];
     
    658657     status = zStrdup(tmpStatus);
    659658  }
    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
    670660  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);
    680668  freeMaps(&conf);
    681669  free(conf);
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png