Skip to content

Instantly share code, notes, and snippets.

@isouzasoares
Created January 27, 2014 13:40
Show Gist options
  • Save isouzasoares/8648725 to your computer and use it in GitHub Desktop.
Save isouzasoares/8648725 to your computer and use it in GitHub Desktop.
def getCidsLugarCerto(req,k):
"""
Retorna a lista de cidade por estado
"""
from mod_ppc.db.ppc_cid_cidade import instancia as ccid
from mod_ppc.config import configVars
from mod_gen.util.py2json import py2json as _py2json
from mod_gen.db.db import close
try:
if(not __validaReferer__(req)): return 'false'
resp = ccid(configVars=configVars, req=req).getLugarCerto(
filtro={
'ppc_est_uf':k['uf']
})
resp = _py2json(resp)
if(k.get('jsoncallback')): resp = k['jsoncallback']+('(%s)' % resp)
return resp
finally:
close(req)
def getCidsMGLugarCerto(req,k):
"""
Retorna a lista de cidade por estado
"""
from mod_ppc.db.ppc_cid_cidade_minas import instancia as ccid
from mod_ppc.config import configVars
from mod_gen.util.py2json import py2json as _py2json
from mod_gen.db.db import close
try:
if(not __validaReferer__(req)): return 'false'
resp = ccid(configVars=configVars, req=req).get(
filtro={
'regiao':k['regiao']
})
resp = _py2json(resp)
if(k.get('jsoncallback')): resp = k['jsoncallback']+('(%s)' % resp)
return resp
finally:
close(req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment