Looks like that the belongs function to the "list:<type>" has changed to
the "contains", that's correct?
Em sábado, 28 de março de 2015 12:43:56 UTC-3, Leonardo Pires Felix
escreveu:
>
> Hi,
> I think on last update the belongs stoped working.
> I've a table that is defined like this:
> db.define_table("regra_entrada",
> Field("descricao", notnull=True, represent=nome, requires
> =[IS_NOT_EMPTY(), IS_UPPER()]),
> Field("data_inicial", "date", widget=SQLFORM.widgets.
> string.widget, represent=campo_date_dia_semana,
> default=request.now.date() + datetime.timedelta(days
> =1), notnull=True),
> Field("data_final", "date", notnull=True, widget=SQLFORM.
> widgets.string.widget,
> represent=campo_date_dia_semana),
> # Definido as delimitações abaixo
> Field("modo", "integer", widget=SQLFORM.widgets.radio.
> widget, notnull=True,
> represent=lambda v, l: _dic_modo[v] if v is not None
> else None, requires=IS_IN_SET(_dic_modo)),
> Field("notificacao_sms", "boolean", notnull=True, default=
> True),
> Field("notificacao_email", "boolean", notnull=True,
> default=True),
> Field("turnos", "list:integer", represent=lambda l, v: ",
> ".join([db.turno(i).sigla for i in l]),
> requires=IS_IN_DB(db, db.turno, multiple=True, label
> =db.turno._format)))
>
> Then, it's populated like this:
> >>> print db(db.regra_entrada.id > 0).select()
> regra_entrada.id,regra_entrada.descricao,regra_entrada.data_inicial,
> regra_entrada.data_final,regra_entrada.modo,regra_entrada.notificacao_sms,
> regra_entrada.notificacao_email,regra_entrada.turnos
> 19,OUTRO TESTE,2015-03-25,2015-05-01,0,True,True,|2|3|1|
>
> The problem is, i'm pretty sure that belongs should be working on this
> case, as i have already tested it on early versions. But now belongs not
> work, this is the outpout for belongs of field "turnos" with "3"(that is on
> the table, on the previous output):
> >>> print db(db.regra_entrada.turnos.belongs([3])).select()
> regra_entrada.id,regra_entrada.descricao,regra_entrada.data_inicial,
> regra_entrada.data_final,regra_entrada.modo,regra_entrada.notificacao_sms,
> regra_entrada.notificacao_email,regra_entrada.turnos
>
>
>
> Maybe something was changed on the version i'm using? Or some specific
> change to the postgres DAL?
>
>
> Web2py version: 2.9.12-stable+timestamp.2015.01.17.06.11.03
> Rocket 1.2.6, Python 2.7.9
> OS: Debian 8(wheezy)
> Postgres: "PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by
> gcc-4.9.real (Debian 4.9.2-10) 4.9.2, 64-bit"
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.