Changeset 624 for trunk/zoo-project


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

Fix for python support.

Location:
trunk/zoo-project
Files:
3 edited

Legend:

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

    r623 r624  
    190190semid getShmLockId(maps* conf, int nsems){
    191191    semid sem_id;
    192         char key[MAX_PATH];
    193         getKeyValue(conf, key, MAX_PATH);
     192    char key[MAX_PATH];
     193    getKeyValue(conf, key, MAX_PATH);
    194194   
    195195    sem_id = CreateSemaphore( NULL, nsems, nsems+1, key);
  • 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);
  • trunk/zoo-project/zoo-services/utils/status/cgi-env/service.py

    r384 r624  
    33    i=0
    44    while i < 100:
    5         conf["lenv"]["status"]=str(i)
     5        conf["lenv"]["message"]="Step "+str(i)
    66        zoo.update_status(conf,i)
    77        time.sleep(0.5)
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