• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python zoo._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zoo._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: GetGroupsUser

def GetGroupsUser(conf,inputs,outputs):
	if is_connected(conf):
		c = auth.getCon(conf)
		if not c.connect():
			conf["lenv"]["message"] = zoo._("SQL connection error")
			return 4
		if not re.match(r"(^\d+$)|(NULL)",inputs["id"]["value"]):
			conf["lenv"]["message"] = zoo._("Parameter id invalid")
			return 4
		if not re.match(r"(^\w+\Z)",inputs["order"]["value"]):
                        conf["lenv"]["message"] = zoo._("Parametre order incorrect")
                        return 4
		if not re.match(r"(desc)|(asc)",inputs["sort"]["value"]):
                        conf["lenv"]["message"] = zoo._("Parameter sort invalid")
                        return 4	
		if c.is_admin(conf["senv"]["login"]):
			if inputs["id"]["value"] == "NULL":
				outputs["Result"]["value"] = json.dumps(c.get_groups_user_by_login(conf["senv"]["login"],inputs["order"]["value"],inputs["sort"]["value"]))
			else:
				outputs["Result"]["value"] = json.dumps(c.get_groups_user_by_id(int(inputs["id"]["value"]),inputs["order"]["value"],inputs["sort"]["value"]))
		else:
			outputs["Result"]["value"] = json.dumps(c.get_groups_user_by_login(conf["senv"]["login"],inputs["order"]["value"],inputs["sort"]["value"]))
		return 3

	else:
		conf["lenv"]["message"]=zoo._("User not authenticated")
		return 4
开发者ID:ThomasG77,项目名称:mapmint,代码行数:27,代码来源:service_users.py


示例2: test

def test(conf, inputs, outputs):
    libxml2.initParser()
    xcontent = (
        "<connection><dbname>"
        + inputs["dbname"]["value"]
        + "</dbname><user>"
        + inputs["user"]["value"]
        + "</user><password>"
        + inputs["password"]["value"]
        + "</password><host>"
        + inputs["host"]["value"]
        + "</host><port>"
        + inputs["port"]["value"]
        + "</port></connection>"
    )
    doc = libxml2.parseMemory(xcontent, len(xcontent))
    styledoc = libxml2.parseFile(conf["main"]["dataPath"] + "/" + inputs["type"]["value"] + "/conn.xsl")
    # print >> sys.stderr,conf["main"]["dataPath"]+"/"+inputs["type"]["value"]+"/conn.xsl"
    style = libxslt.parseStylesheetDoc(styledoc)
    result = style.applyStylesheet(doc, None)
    # print >> sys.stderr,"("+result.content+")"
    ds = osgeo.ogr.Open(result.content)
    if ds is None:
        conf["lenv"]["message"] = zoo._("Unable to connect to ") + inputs["name"]["value"]
        return 4
    else:
        outputs["Result"]["value"] = zoo._("Connection to ") + inputs["name"]["value"] + zoo._(" successfull")
    ds = None
    return 3
开发者ID:nbozon,项目名称:mapmint,代码行数:29,代码来源:service.py


示例3: AddUser

def AddUser(conf,inputs,outputs):
	if is_connected(conf):
		c = auth.getCon(conf)
		prefix=auth.getPrefix(conf)
		if c.is_admin(conf["senv"]["login"]):
			try:
				user = json.loads(inputs["user"]["value"])
                	except Exception,e:
				print >> sys.stderr,inputs["user"]["value"]
                        	print >> sys.stderr,e
                        	conf["lenv"]["message"] = zoo._("invalid user parameter: ")+inputs["user"]["value"]
                        	return 4
			for (i,j) in user.items():
				if not manage_users.check_user_params(i,j):
					conf["lenv"]["message"] = 'Parametre %s incorrect'%(i)
					return 4
			if c.add_user(user):
				outputs["Result"]["value"] = inputs["user"]["value"]
				if inputs.has_key("group"):
					if inputs["group"].has_key("length"):
						for i in range(0,len(inputs["group"]["value"])):
							linkGroupToUser(c,prefix,inputs["group"]["value"],inputs["login"]["value"])
					else:
						linkGroupToUser(c,prefix,inputs["group"]["value"],user["login"])
				return 3
			else:
				conf["lenv"]["message"] = zoo._("SQL Error")
				return 4
		else:
			conf["lenv"]["message"]= zoo._("Action not permited")
			return 4
开发者ID:ThomasG77,项目名称:mapmint,代码行数:31,代码来源:service_users.py


示例4: SecureAccess

def SecureAccess(conf,inputs,outputs):
    global myCookies
    mapfile=conf["main"]["dataPath"]+"/public_maps/project_"+inputs["server"]["value"]+".map"
    try:
    	myMap=mapscript.mapObj(mapfile)
    except:
        conf["lenv"]["message"]=zoo._("Unable to find any project with this name!")
	return zoo.SERVICE_FAILED
    c = auth.getCon(conf)
    prefix=auth.getPrefix(conf)
    if not(validToken(c,prefix,inputs["token"]["value"])):
        conf["lenv"]["message"]=zoo._("Unable to validate your token!")
        return zoo.SERVICE_FAILED
    if not(validIp(conf,c,prefix,inputs["ip"]["value"],0,[inputs["server"]["value"]])):
        conf["lenv"]["message"]=zoo._("You are not allowed to access the ressource using this ip address!")
        return zoo.SERVICE_FAILED
    q=None
    if inputs["Query"]["mimeType"]=="application/json":
        import json
        q=json.loads(inputs["Query"]["value"])
    myAutorizedGroups=myMap.web.metadata.get('mm_access_groups').split(',')
    if myAutorizedGroups.count('public')==0 and not(q is None or q["request"].upper()=="GETCAPABILITIES" or q["request"].upper()=="GETLEGENDGRAPHIC") and not(tryIdentifyUser(conf,inputs["user"]["value"],inputs["password"]["value"])):
        conf["lenv"]["message"]=zoo._("You are not allowed to access the ressource using this user / password!")
        conf["lenv"]["status_code"]="401 Unauthorized"
        print >> sys.stderr,conf["lenv"]
        return zoo.SERVICE_FAILED
    if conf.keys().count("senv")==0:
        conf["senv"]={"group": getGroupFromToken(c,prefix,inputs["token"]["value"])}
    else:
        print >> sys.stderr,conf["senv"]
    try:
    	myCurrentGroups=conf["senv"]["group"].split(',')
    except Exception,e:
    	myCurrentGroups=[]
开发者ID:mapmint,项目名称:mapmint,代码行数:34,代码来源:service.py


示例5: addColumn

def addColumn(conf,inputs,outputs):
    print >> sys.stderr,inputs["dataStore"]["value"]
    db=pgConnection(conf,inputs["dataStore"]["value"])
    db.parseConf()
    req=[]
    if db.connect():
        if inputs["field_type"]["value"]!="18":
            req+=["ALTER TABLE quote_ident("+inputs["table"]["value"]+") ADD COLUMN "+inputs["field_name"]["value"]+" "+fetchType(conf,inputs["field_type"]["value"])]
            outputs["Result"]["value"]=zoo._("Column added")
        else:
            tblInfo=inputs["table"]["value"].split(".")
            if len(tblInfo)==1:
                tmp=tblInfo[0]
                tblInfo[0]="public"
                tblInfo[1]=tmpl
            req+=["SELECT AddGeometryColumn('"+tblInfo[0]+"','"+tblInfo[1]+"','wkb_geometry',(select srid from spatial_ref_sys where auth_name||':'||auth_srid = '"+inputs["proj"]["value"]+"'),'"+inputs["geo_type"]["value"]+"',2)"]
            outputs["Result"]["value"]=zoo._("Geometry column added.")
            if inputs.keys().count("geo_x")>0 and inputs.keys().count("geo_y")>0:
                req+=["CREATE TRIGGER mm_tables_"+inputs["table"]["value"].replace(".","_")+"_update_geom BEFORE UPDATE OR INSERT ON "+inputs["table"]["value"]+" FOR EACH ROW EXECUTE PROCEDURE automatically_update_geom_property('"+inputs["geo_x"]["value"]+"','"+inputs["geo_y"]["value"]+"','"+inputs["proj"]["value"]+"')"]
                outputs["Result"]["value"]+=" "+zoo._("Trigger in place")
            print >> sys.stderr,req
        for i in range(0,len(req)):
            if not(db.execute(req[i])):
                return zoo.SERVICE_FAILED
        db.conn.commit()
        return zoo.SERVICE_SUCCEEDED
    else:
        conf["lenv"]["message"]=zoo._("Unable to connect")
    return zoo.SERVICE_FAILED
开发者ID:mapmint,项目名称:mapmint,代码行数:29,代码来源:pgConnection.py


示例6: Intersection

def Intersection(conf,inputs,outputs):
    geometry1=extractInputs(conf,inputs["InputEntity1"])
    geometry2=extractInputs(conf,inputs["InputEntity2"])
    print >> sys.stderr, "***** 1: "+str(len(geometry1))+" 2: "+str(len(geometry2))
    rgeometries=[]
    fids=[]
    i=0
    for i in range(len(geometry1)):
        conf["lenv"]["message"]="("+str(i)+"/"+str(len(geometry1))+") "+zoo._("Running process...")
        zoo.update_status(conf,(i*100)/len(geometry1))
        j=0
        for j in range(len(geometry2)):
            tmp=geometry2[j].Clone()
            #resg=validateGeom(geometry2[j].GetGeometryRef())
            resg=geometry2[j].GetGeometryRef()
            #print >> sys.stderr," ***** 1 : "+str(resg)
            #resg=resg.Intersection(geometry1[i].GetGeometryRef())
            if len(geometry1)==1:
                conf["lenv"]["message"]="("+str(j)+"/"+str(len(geometry2))+") "+zoo._("Run intersection process...")
                zoo.update_status(conf,(j*100)/len(geometry2))
            if geometry1[i].GetGeometryRef().GetGeometryType()==osgeo.ogr.wkbMultiPolygon:
                for k in range(geometry1[i].GetGeometryRef().GetGeometryCount()):
                    try:
                        #tmpGeom=validateGeom(geometry1[i].GetGeometryRef().GetGeometryRef(k))
                        tmpGeom=geometry1[i].GetGeometryRef().GetGeometryRef(k)
                        if tmpGeom.Intersects(resg):
                            tmp1=geometry2[j].Clone()
                            #print >> sys.stderr," ***** 2 : "+str(resg)
                            resg1=tmpGeom.Intersection(resg)
                            #tmp1.SetGeometryDirectly(validateGeom(resg1))
                            tmp1.SetGeometryDirectly(resg1)
                            tmp1.SetFID(len(rgeometries))
                            if resg1 is not None and not(resg1.IsEmpty()):# and fids.count(tmp.GetFID())==0:
                                rgeometries+=[tmp1]
                                fids+=[tmp.GetFID()]
                            else:
                                tmp1.Destroy()
                    except Exception,e:
                        #tmp1.Destroy()
                        print >>sys.stderr,e
                tmp.Destroy()
            else:
                #print >> sys.stderr," ***** 2 : "+str(geometry1[i].GetGeometryRef())
                #resg=validateGeom(geometry1[i].GetGeometryRef()).Intersection(validateGeom(resg))
                #resg=validateGeom(geometry1[i].GetGeometryRef()).Intersection(resg)
                resg=geometry1[i].GetGeometryRef().Intersection(resg)
                #print >> sys.stderr," ***** 3 : "+str(resg)
                try:
                    #tmp.SetGeometryDirectly(validateGeom(resg))
                    tmp.SetGeometryDirectly(resg)
                    tmp.SetFID(len(rgeometries))
                    if resg is not None and not(resg.IsEmpty()):# and fids.count(tmp.GetFID())==0:
                        rgeometries+=[tmp]
                        fids+=[tmp.GetFID()]
                    else:
                        tmp.Destroy()
                except Exception,e:
                    print >>sys.stderr,e
开发者ID:mapmint,项目名称:mapmint,代码行数:58,代码来源:service.py


示例7: delete

def delete(conf,inputs,outputs):
	try: 
		#print >> sys.stderr, conf["main"]["dataPath"]+"/"+inputs["type"]["value"]+"/"+inputs["name"]["value"]+".xml"
		os.unlink(conf["main"]["dataPath"]+"/"+inputs["type"]["value"]+"/"+inputs["name"]["value"]+".xml")
	except:
		conf["lenv"]["message"]=zoo._("Unable to access the database configuration file to remove")
		return 4
	outputs["Result"]["value"]=zoo._("Database ")+inputs["name"]["value"]+zoo._(" was successfully removed from the Datastores")
	return 3
开发者ID:gislite,项目名称:mapmint,代码行数:9,代码来源:service.py


示例8: save

def save(conf,inputs,outputs):
	try: 
		f = open(conf["main"]["dataPath"]+"/"+inputs["type"]["value"]+"/"+inputs["name"]["value"]+".txt", 'w')
	except:
		return 4
	try:
		f.write(inputs["url"]["value"]+"\n");
	except:
		return 4
	outputs["Result"]["value"]=zoo._("Data Store ")+inputs["name"]["value"]+zoo._(" created")
	return 3
开发者ID:mapmint,项目名称:mapmint,代码行数:11,代码来源:service.py


示例9: clogOut

def clogOut(conf,inputs,outputs):
	if conf.keys().count("senv")>0 and conf["senv"].keys().count("loggedin")>0 and conf["senv"]["loggedin"]=="true":
		outputs["Result"]["value"]=zoo._("User disconnected")
		conf["senv"]["loggedin"]="false"
		conf["senv"]["login"]="anonymous"
		return zoo.SERVICE_SUCCEEDED
	else:
		conf["lenv"]["message"]=zoo._("User not authenticated")
		return zoo.SERVICE_FAILED
	conf["lenv"]["message"]=zoo._("User not authenticated")
	return zoo.SERVICE_FAILED
开发者ID:ThomasG77,项目名称:mapmint,代码行数:11,代码来源:service.py


示例10: logOut

def logOut(conf,inputs,outputs):
	if conf.keys().count("senv")>0 and conf["senv"].keys().count("loggedin")>0 and conf["senv"]["loggedin"]=="true":
		outputs["Result"]["value"]=zoo._("User disconnected")
		conf["senv"]["loggedin"]="false"
		#conf["lenv"]["cookie"]="MMID=deleted; expires="+time.strftime("%a, %d-%b-%Y %H:%M:%S GMT",time.gmtime())+"; path=/"
		return zoo.SERVICE_SUCCEEDED
	else:
		conf["lenv"]["message"]=zoo._("User not authenticated")
		return zoo.SERVICE_FAILED
	conf["lenv"]["message"]=zoo._("User not authenticated")
	return zoo.SERVICE_FAILED
开发者ID:aristide,项目名称:mapmint,代码行数:11,代码来源:service.py


示例11: delete

def delete(conf,inputs,outputs):
	try: 
		os.unlink(conf["main"]["dataPath"]+"/"+inputs["type"]["value"]+"/"+inputs["name"]["value"]+".txt")
	except:
		conf["lenv"]["message"]=zoo._("Unable to access the Data Store configuration file to remove")
		return 4
	try:
		os.unlink(conf["main"]["dataPath"]+"/"+inputs["type"]["value"]+"/"+inputs["name"]["value"]+"ds_ows.map")
		os.unlink(conf["main"]["dataPath"]+"/"+inputs["type"]["value"]+"/"+inputs["name"]["value"]+".mmpriv")
	except:
		pass
	outputs["Result"]["value"]=zoo._("Database ")+inputs["name"]["value"]+zoo._(" was successfully removed from the Data Stores")
	return 3
开发者ID:mapmint,项目名称:mapmint,代码行数:13,代码来源:service.py


示例12: test

def test(conf,inputs,outputs):
    try:
        if inputs["type"]["value"].upper()=="WMS":
            import osgeo.gdal
            ds=osgeo.gdal.Open(inputs["type"]["value"]+":"+inputs["url"]["value"])
            ds.GetDriver()
        else:
            import osgeo.ogr
            ds=osgeo.ogr.Open(inputs["type"]["value"]+":"+inputs["url"]["value"])
            ds.GetDriver()
        outputs["Result"]["value"]=zoo._("Test connecting the Data Store ")+inputs["name"]["value"]+zoo._(" run successfully")
        return zoo.SERVICE_SUCCEEDED
    except Exception,e:
        conf["lenv"]["message"]=zoo._("Unable to access the Data Store:")+str(e)
        return zoo.SERVICE_FAILED
开发者ID:mapmint,项目名称:mapmint,代码行数:15,代码来源:service.py


示例13: clogOut

def clogOut(conf,inputs,outputs):
    if conf.keys().count("senv")>0 and conf["senv"].keys().count("loggedin")>0 and conf["senv"]["loggedin"]=="true":
        outputs["Result"]["value"]=zoo._("User disconnected")
        conf["senv"]["loggedin"]="false"
        conf["senv"]["login"]="anonymous"
        conf["senv"]["group"]="public"
        conf["lenv"]["ecookie_length"]="1"
        conf["lenv"]["ecookie"]="sid=empty"
        conf["lenv"]["cookie"]="MMID="+conf["lenv"]["usid"]+"; expires="+time.strftime("%a, %d-%b-%Y %H:%M:%S GMT",time.gmtime())+"; path=/"
        return zoo.SERVICE_SUCCEEDED
    else:
        conf["lenv"]["message"]=zoo._("User not authenticated")
        return zoo.SERVICE_FAILED
    conf["lenv"]["message"]=zoo._("User not authenticated")
    return zoo.SERVICE_FAILED
开发者ID:mapmint,项目名称:mapmint,代码行数:15,代码来源:service.py


示例14: GetUsersGroup

def GetUsersGroup(conf,inputs,outputs):
	if is_connected(conf):
		c = auth.getCon(conf)
		if not re.match(r"(^\d+$)",inputs["id"]["value"]):
			conf["lenv"]["message"] = zoo._("Parametre id incorrect")
			return 4
		if c.is_admin(conf["senv"]["login"]):
			outputs["Result"]["value"] = json.dumps(c.get_users_group_by_id(int(inputs["id"]["value"]),inputs["order"]["value"],inputs["sort"]["value"]))
			return 3
		else:
			conf["lenv"]["message"]= zoo._("Action not permited")
			return 4
	else:
		conf["lenv"]["message"]=zoo._("User not authenticated")
		return 4
开发者ID:ablayelana,项目名称:mapmint,代码行数:15,代码来源:service_users.py


示例15: addSymbolToOrig

def addSymbolToOrig(conf,inputs,outputs):
    import sys
    from Cheetah.Template import Template
    f=open(conf["main"]["dataPath"]+"/symbols.sym","r")
    newContent=""
    str=f.read()
    f.close()
    i=0
    b=str.split('SYMBOL\n')
    for a in b:
        if a!="" and a!='\n':
            if i+1 < len(b):
                if newContent!="":
                    newContent+='SYMBOL\n'+a
                else:
                    newContent+=a
            else:
                print >> sys.stderr,a[:len(a)-4]
                newContent+='SYMBOL\n'+a[:len(a)-5]
            i+=1
    t=Template(file=conf["main"]["templatesPath"]+"/Manager/Styler/Symbols.sym.tmpl",searchList={"conf": conf,"inputs": inputs,"outputs": outputs})
    newContent+=t.__str__().replace('SYMBOLSET\n',"")
    f=open(conf["main"]["dataPath"]+"/symbols.sym","w")
    f.write(newContent)
    f.close()
    outputs["Result"]["value"]=zoo._("Symbol added.")
    return 3
开发者ID:ThomasG77,项目名称:mapmint,代码行数:27,代码来源:service.py


示例16: deleteSymbolFromOrig

def deleteSymbolFromOrig(conf,inputs,outputs):
    import sys
    import json
    from Cheetah.Template import Template
    f=open(conf["main"]["dataPath"]+"/symbols.sym","r")
    newContent=""
    str=f.read()
    f.close()
    i=0
    if inputs["name"].keys().count("length")==0:
        inputs["name"]["value"]=[inputs["name"]["value"]]
    b=str.split('SYMBOL\n')
    for a in b:
        hasValue=False
        if a!="" and a!='\n':
            for j in range(len(inputs["name"]["value"])):
                if a.count(inputs["name"]["value"][j])>0:
                    hasValue=True
            if not(hasValue):
                if newContent!="":
                    newContent+='SYMBOL\n'+a
                else:
                    newContent+=a
            else:
                if i+1==len(b):
                    newContent+="\nEND\n"
            i+=1
    f=open(conf["main"]["dataPath"]+"/symbols.sym","w")
    f.write(newContent)
    f.close()
    outputs["Result"]["value"]=zoo._("Symbol removed.")
    return 3
开发者ID:aristide,项目名称:mapmint,代码行数:32,代码来源:service.py


示例17: saveUserPreferences

def saveUserPreferences(conf,inputs,outputs):
	con=getCon(conf)
	con.connect()
	conn = con.conn
	prefix=getPrefix(conf)
	j=0
	sqlStr=""
	if inputs["fields"].has_key("length"):
		for i in inputs["fields"]["value"]:
			if i!="login" and inputs["values"]["value"][j]!="NULL":
				if sqlStr!="":
					sqlStr+=", "
				if i=="passwd":
					h = hashlib.new('ripemd160')
					h.update(inputs["values"]["value"][j])
					sqlStr+=i+"='"+h.hexdigest()+"'"
				else:
					sqlStr+=i+"='"+inputs["values"]["value"][j]+"'"
			j+=1
	else:
		sqlStr+=inputs["fields"]["value"]+"='"+inputs["values"]["value"]+"'"		
	print >> sys.stderr,sqlStr
	cur=conn.cursor()
	try:
		sql="UPDATE "+prefix+"users set "+sqlStr+" where login='"+conf["senv"]["login"]+"'"
		print >> sys.stderr,sql
		cur.execute(sql)
		conn.commit()
	except Exception,e:
		conf["lenv"]["message"]=zoo._("Unable to update user preferences: ")+str(e)
		return zoo.SERVICE_FAILED
开发者ID:ThomasG77,项目名称:mapmint,代码行数:31,代码来源:service.py


示例18: saveGeorefProject

def saveGeorefProject(conf,inputs,outputs):
    import mmsession
    import mapfile.service as ms

    mapfile=conf["main"]["dataPath"]+"/georeferencer_maps/project_"+inputs["map"]["value"]+".map"
    m = mapscript.mapObj(mapfile)
    conf["senv"]["mmGeoDST"]=m.web.metadata.get("mmGeoDST")
    conf["senv"]["mmGeoDSO"]=m.web.metadata.get("mmGeoDSO")
    if inputs.has_key("dso") and inputs["dso"]["value"]=="NULL":
        inputs["dso"]["value"]=m.getLayer(0).name
    conf["senv"]["mmGeoMap"]=inputs["dso"]["value"]

    import shutil
    ofile=m.getLayer(0).data
    shutil.copy2(ofile,conf["main"]["tmpPath"])
    conf["senv"]["mmGeoImg"]=ofile.split('/')[len(ofile.split('/'))-1]

    mmsession.save(conf)

    if not(os.path.isfile(conf["main"]["dataPath"]+"/georeferencer_maps/project_"+inputs["dso"]["value"]+".map")) or (inputs.has_key("force") and inputs["force"]["value"]=="true"):
	try:
	    os.mkdir(conf["main"]["dataPath"]+"/georeferencer_maps/"+inputs["dso"]["value"])
	    import glob
	    for name in glob.glob(conf["main"]["dataPath"]+"/georeferencer_maps/"+inputs["map"]["value"]+"/*.csv"):
                shutil.copy2(name,conf["main"]["dataPath"]+"/georeferencer_maps/"+inputs["dso"]["value"])
	except:
	    pass
        m.save(conf["main"]["dataPath"]+"/georeferencer_maps/project_"+inputs["dso"]["value"]+".map")
    outputs["Result"]["value"]=zoo._("Georeference Project saved")
    return zoo.SERVICE_SUCCEEDED
开发者ID:ThomasG77,项目名称:mapmint,代码行数:30,代码来源:service.py


示例19: saveDataStorePrivileges

def saveDataStorePrivileges(conf,inputs,outputs):
    path=getPath(conf,inputs["dataStore"]["value"])
    cStr=""
    if inputs["group"].has_key("length"):
        for i in range(0,len(inputs["group"]["value"])):
            if cStr!="":
                cStr+="\n"
            cStr+=inputs["group"]["value"][i]
            for j in ["r","w","x"]:
                if inputs["ds_"+j]["value"][i]=="true":
                    inputs["ds_"+j]["value"][i]="1"
                else:
                    if inputs["ds_"+j]["value"][i]=="false":
                        inputs["ds_"+j]["value"][i]="0"
                cStr+=","+inputs["ds_"+j]["value"][i]
    else:
        cStr+=inputs["group"]["value"]
        for j in ["r","w","x"]:
            if inputs["ds_"+j]["value"]=="true":
                inputs["ds_"+j]["value"]="1"
            else:
                if inputs["ds_"+j]["value"]=="false":
                    inputs["ds_"+j]["value"]="0"
            cStr+=","+inputs["ds_"+j]["value"]
    f=open(path+".mmpriv","wb")
    f.write(cStr)
    f.close()
    outputs["Result"]["value"]=zoo._("Privileges saved")
    return zoo.SERVICE_SUCCEEDED
开发者ID:mapmint,项目名称:mapmint,代码行数:29,代码来源:service.py


示例20: saveGeoreferencedProject

def saveGeoreferencedProject(conf,inputs,outputs):
    import mmsession
    import mapfile.service as ms

    mapfile=inputs["dst"]["value"]+"ds_ows.map"
    m = mapscript.mapObj(mapfile)
    ms.removeAllLayers(m,inputs["dso"]["value"])

    m.web.metadata.set("mmGeoDST",inputs["dst"]["value"])
    conf["senv"]["mmGeoDST"]=inputs["dst"]["value"]
    
    m.web.metadata.set("mmGeoDSO",inputs["dso"]["value"])
    conf["senv"]["mmGeoDSO"]=inputs["dso"]["value"]
    conf["senv"]["mmGeoMap"]=inputs["dso"]["value"]

    import shutil
    ofile=m.getLayer(0).data
    shutil.copy2(ofile,conf["main"]["tmpPath"])
    conf["senv"]["mmGeoImg"]=ofile.split('/')[len(ofile.split('/'))-1]

    if inputs.keys().count("gcpfile")>0:
	    m.web.metadata.set("mmGeoGCPFile",inputs["gcpfile"]["value"])
	    conf["senv"]["mmGeoGCPFile"]=inputs["gcpfile"]["value"]
    mmsession.save(conf)
    if not(os.path.isfile(conf["main"]["dataPath"]+"/georeferencer_maps/project_"+inputs["dso"]["value"]+".map")):
        m.save(conf["main"]["dataPath"]+"/georeferencer_maps/project_"+inputs["dso"]["value"]+".map")
    outputs["Result"]["value"]=zoo._("Georeference Project saved")
    return zoo.SERVICE_SUCCEEDED
开发者ID:gislite,项目名称:mapmint,代码行数:28,代码来源:service.py



注:本文中的zoo._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python shortcuts.render函数代码示例发布时间:2022-05-26
下一篇:
Python browser.ZodbInfoView类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap