Alan Etkin escribió:
request.date.now() works well in my system (Python 2.6.5, web2py
1.99.3, Linux)
I think you mean request.now.date() (request.date doesn't exist in my system, web2py 1.99.3 with python 2.7.2 on gnu/linux too)

Would you post part of the model and controller to see what it does?
of course:

============================
MODEL:

dbi = db_informes.define_table

dbi('historia',
    Field('brand_id', 'integer'),
    Field('brand_name'),
    Field('positivos', 'integer'),
    Field('negativos', 'integer'),
    Field('nulos', 'integer'),
    Field('total_votos',
          compute = lambda v: v['positivos'] + v['negativos'] + v['nulos']
          ),
    Field('fecha', 'string')
    )
============================


FUNCTION
============================
def historico_brand():
    import datetime

#date = datetime.datetime.now() #error1: "need more than 1 value to unpack"
    #date = request.now.date() #error1: "need more than 1 value to unpack"
#date = datetime.datetime.now().date() #error1: "need more than 1 value to unpack" date = str(datetime.datetime.now()) #NO error1, but doesn't update (always insert)'

    for b in db(db.brand).select(db.brand.id, db.brand.name):

        data = db((db.brand.id == b.id)
& (db.address.brand == db.brand.id)
& (db.address.id == db.rec.address)
& (db.rec.id == db.vote_attribute.rec)
                  ).select()

        t = f = n = 0

        for d in data:
            if d.vote_attribute.vote == True:
                t += 1
            elif d.vote_attribute.vote == False:
                f += 1
            else:
                n += 1


        db_informes.historia.update_or_insert(
                            brand_id = b.id,
                            brand_name = b.name,
                            positivos = t,
                            negativos = f,
                            nulos = n,
                            fecha = date
                            )
    return True
============================


On 14 dic, 19:43, Daniel Aguayo Catalán<daniel.agu...@gmail.com>
wrote:
Alan Etkin escribi :>>  datepart,timepart=val.split(" ")ValueError:need more 
than1value to unpack
It looks like convert_timestamp() in pysqlite2.dbapi2 is expecting a
date+time object and receives a date, isn't it?
Hi, I forgot to say that the problem exists even if I try to insert a
request.now value.

If I try to insert a datetime.datetime.now() object the same problem
doesn't show, but then the 'update_or_insert' function see it as a new
entry, doing always an insert

Reply via email to