Hi All, I have three problems - Please help me understand how to troubleshoot these
Problem1 - (Primary issue) I have a table as below - How do I handle unique = True and notnull= True fields i.e when I am doing negative testing and adding similar fields, it throws me an exception. I am using web2py 1.99.4 , win7 and sqlite3 #users will be registered using email and password db.define_table('reguser', Field('first_name', length=128), Field('last_name', length=128), Field('date_of_birth','date', requires=IS_DATE(format='%m/%d/%Y')), Field('marital_status', length=10, requires=IS_IN_SET(marital_status)), Field('gender', requires=IS_IN_SET(["Male", "Female", "Other"])), Field('cell_no', length=15), Field('email', length=512, unique=True, notnull=True), Field('address', length=512), Field('city', length=256), Field('zip', length=10), Field('unique_code', length=128, unique=True ), #, comment='Eg. Architects code' Field('profile_pic', 'upload'), Field('created_on', 'date' , default= now, writable=False), Field('user_type', requires=IS_IN_SET(user_types)), Field('user_status', requires=IS_IN_SET(user_status)), Field('user_rights', requires=IS_IN_SET(user_rights)), Field('user_name', length=128, label='Display Name'), Field('password', 'password'), Field('password_question', length=128), Field('answer', length=128) ) --------Error Message--------- Traceback (most recent call last): File "D:\WEB2PY\web2py\gluon\restricted.py", line 204, in restricted exec ccode in environment File "D:\WEB2PY\web2py\applications\Build_Connect\controllers/ default.py", line 998, in <module> File "D:\WEB2PY\web2py\gluon\globals.py", line 172, in <lambda> self._caller = lambda f: f() File "D:\WEB2PY\web2py\applications\Build_Connect\controllers/ default.py", line 86, in syslogin form = crud.create(db.reguser) File "D:\WEB2PY\web2py\gluon\tools.py", line 3126, in create formname=formname, File "D:\WEB2PY\web2py\gluon\tools.py", line 3069, in update detect_record_change = self.settings.detect_record_change): File "D:\WEB2PY\web2py\gluon\sqlhtml.py", line 1267, in accepts self.vars.id = self.table.insert(**fields) File "D:\WEB2PY\web2py\gluon\dal.py", line 5597, in insert return self._db._adapter.insert(self,self._listify(fields)) File "D:\WEB2PY\web2py\gluon\dal.py", line 914, in insert raise eIntegrityError: column email is not unique --------------------------- Problem2: How can I cache images that I have added for users who have added comments. Example- I have a web page where I have users comment over my posts. These users have id's defined and photos specified, how can I prevent loading one image at a time? Problem3: How to restrict upload of files (any files including images) to say 512 kb or any size there of? Regards, Rahul (www.flockbird.com)