Custom Query (121 matches)
Results (13 - 15 of 121)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #168 | invalid | Appengine query models | xi | martinhoarantes@… |
| Description |
Hi, I´m using Google Appengine, language Python. I´d like to know how to query a model. I´m using this code, but the output is miserable: class GerarYAML(webapp.RequestHandler):
def post(self):
user = users.get_current_user()
if user:
formacaos = models.Formacao().all()
experiencias = models.Experiencia().all()
investigacaos = models.Investigacao().all()
distribuicaos = models.Distribuicao().all()
docentes = models.Docente.all()
docentes.filter('user =', users.get_current_user())
for docente in docentes:
for formacao in formacaos:
for experiencia in experiencias:
for investigacao in investigacaos:
for distribuicao in distribuicaos:
formacao.docente = docente.key()
'Nome: %s' % (docente.nome)
'Apelido: %s' % (docente.apelido)
'Unidade: %s' % (docente.unidade)
'Categoria: %s' % (docente.categoria)
'Regime: %s' % (docente.regime)
'Formacao: %s' % (formacao.formAno)
'Grau de Formacao: %s' % (formacao.formGrau)
'Area de Formacao: %s' % (formacao.formArea)
'Instituicao Academica: %s' % (formacao.formInstituicao)
'Classificacao Final: %s' % (formacao.formClassificacao)
yaml.dump(docente, sys.stdout)
yaml.dump(formacao, sys.stdout)
yaml.dump(experiencia, sys.stdout)
yaml.dump(investigacao, sys.stdout)
yaml.dump(distribuicao, sys.stdout)
self.response.headers['Content-Type'] = 'application/yaml'
self.response.headers['Content-Disposition'] = 'filename = my.yaml'
Can someone point out, how can i solve this issue? I´d like to download a file automatically when user submit a button with .yaml format and more or less formatted. |
|||
| #167 | worksforme | Please help saving dict to yaml | xi | anonymous |
| Description |
Hi, is there any way of saving dict to a file in yaml format? I'm using:
----------------------------------------
#!/usr/bin/python
import yaml
y = """
root:
- subject1:
desc: msg1
- subject2:
desc: msg2
"""
settings=yaml.load(y)
settings['root'][0]['subject1']['desc'] = "new msg"
print settings
f = open("temp", "w")
f.write(str(settings))
----------------------------------------
but failing miserably, contents of the temp file:
{'root': [{'subject1': {'desc': 'new msg'}}, {'subject2': {'desc': 'msg2'}}]}
expected result:
root:
- subject1:
desc: new msg
- subject2:
desc: msg2
Is there anything like yaml.save? Any help greatly appreciated!
Regards,
Tomas
|
|||
| #166 | wontfix | PyYAML should use libyaml if libyaml available | xi | sgwong |
| Description |
Currently PyYAML only use python implementation although the libyaml available. The following simple changes on __init__.py should do: (I'm not sure whats the use of __with_libyaml__) __version__ = '3.09' try: from cyaml import * __with_libyaml__ = True Loader = CLoader Dumper = CDumper except ImportError: __with_libyaml__ = False |
|||
Note: See TracQuery
for help on using queries.
