For some reason using SQLFORM with a field upload doesn't work, it
submits and adds to the db fine all the other fields but not the
image. When i check the logs I'm getting this error.

/gluon/sql.py:653: Warning: Field 'viewed' doesn't have a default
value
  self._execute = lambda *a, **b: self._cursor.execute(*a,**b)

Also trying to set a custom validator doesn't work, no errors just
doesn't effect it.

db.define_table("photos",
        db.Field("picture", "upload", notnull=True),
        db.Field("ratings_id", db.ratings),
        db.Field("date_added", "datetime", notnull=True,
default=request.now),
        db.Field("viewed", "integer", notnull=True, default=None),
        migrate=yourfm.migrate
)
class IS_GIF:
    def __init__(self,error_message='needs to be gif.'):
        self.error_message=error_message
        print 'started'
    def __call__(self,value):
        print str(value)
        if value and value.filename[-4:].lower()!='.gif':
            return (value,self.error_message)
        return (value,None)
db.photos.picture.requires=IS_GIF()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to