The error seems to be in viewcompany, it expects to find at least one
record but the db is empty. This is an application error.

On Oct 8, 11:27 pm, Sujith <[email protected]> wrote:
> Hi
> I have customized the Jobsite appliance. In the _ah/admin the
> following tables are created:
> web2py_session_init
> web2py_tickets_init
>
> The other tables defined in the model are not getting created.
>
> On most of the pages, an Internal error is being generated. This is
> one of the entries from web2py_tickets_init:
> ******************************************
> (dp0
> S'output'
> p1
> S''
> p2
> sS'layer'
> p3
> S'/home/sujith/Desktop/wcj/applications/init/controllers/default.py'
> p4
> sS'code'
> p5
> S'<code object <module> at 0xa8ddf50, file "/home/sujith/Desktop/wcj/
> applications/init/controllers/default.py:viewcompany", line 8>'
> p6
> sS'snapshot'
> p7
> (dp8
> S'exception'
> p9
> (dp10
> S'__hash__'
> p11
> S"<method-wrapper '__hash__' of exceptions.IndexError object at
> 0xa988cac>"
> p12
> sS'__setattr__'
> p13
> S"<method-wrapper '__setattr__' of exceptions.IndexError object at
> 0xa988cac>"
> p14
> sS'__reduce_ex__'
> p15
> S'<built-in method __reduce_ex__ of exceptions.IndexError object at
> 0xa988cac>'
> p16
> sS'__getslice__'
> p17
> S"<method-wrapper '__getslice__' of exceptions.IndexError object at
> 0xa988cac>"
> p18
> sS'__getitem__'
> p19
> S"<method-wrapper '__getitem__' of exceptions.IndexError object at
> 0xa988cac>"
> p20
> sS'__setstate__'
> p21
> S'<built-in method __setstate__ of exceptions.IndexError object at
> 0xa988cac>'
> p22
> sS'__reduce__'
> p23
> S'<built-in method __reduce__ of exceptions.IndexError object at
> 0xa988cac>'
> p24
> sS'__str__'
> p25
> S"<method-wrapper '__str__' of exceptions.IndexError object at
> 0xa988cac>"
> p26
> sS'args'
> p27
> S"('list index out of range',)"
> p28
> sS'__getattribute__'
> p29
> S"<method-wrapper '__getattribute__' of exceptions.IndexError object
> at 0xa988cac>"
> p30
> sS'__class__'
> p31
> S"<type 'exceptions.IndexError'>"
> p32
> sS'__delattr__'
> p33
> S"<method-wrapper '__delattr__' of exceptions.IndexError object at
> 0xa988cac>"
> p34
> sS'__repr__'
> p35
> S"<method-wrapper '__repr__' of exceptions.IndexError object at
> 0xa988cac>"
> p36
> sS'__dict__'
> p37
> S'{}'
> p38
> sS'__doc__'
> p39
> S"'Sequence index out of range.'"
> p40
> sS'__init__'
> p41
> S"<method-wrapper '__init__' of exceptions.IndexError object at
> 0xa988cac>"
> p42
> sS'__new__'
> p43
> S'<built-in method __new__ of type object at 0x8142e60>'
> p44
> ssS'evalue'
> p45
> S'list index out of range'
> p46
> sS'request'
> p47
> (dp48
> S'function'
> p49
> S"'viewcompany'"
> p50
> sS'body'
> p51
> S'<cStringIO.StringO object at 0xa3cd8c0>'
> p52
> sS'wsgi'
> p53
> S"<Storage {'start_response': <function <lambda> a...UTC',
> 'PATH_INFO': '/init/default/viewcompany'}}>"
> p54
> sS'extension'
> p55
> S"'html'"
> p56
> sS'vars'
> p57
> S'<Storage {}>'
> p58
> sS'cid'
> p59
> S'None'
> p60
> sS'url'
> p61
> S'<gluon.html.XML object at 0xa40362c>'
> p62
> sg27
> S'[]'
> p63
> sS'controller'
> p64
> S"'default'"
> p65
> sS'cookies'
> p66
> S"<SimpleCookie: csrftoken='9ffde5a05fb91ec51c4699...82'
> sessionid='6ec993cc1ed48ab0c32215570c0854e7'>"
> p67
> sS'tickets_db'
> p68
> S"<SQLDB {'_lastsql': 'SELECT WHERE id = 1', '_db_...eobj': <class
> 'gluon.contrib.gql.applicants'>}>}>"
> p69
> sS'application'
> p70
> S"'init'"
> p71
> sS'ajax'
> p72
> S'False'
> p73
> sS'client'
> p74
> S"'127.0.0.1'"
> p75
> sS'env'
> p76
> S"<Storage {'content_length': '', 'http_user_agent...': '',
> 'path_info': '/init/default/viewcompany'}>"
> p77
> sS'raw_args'
> p78
> S'None'
> p79
> sS'get_vars'
> p80
> S'<Storage {}>'
> p81
> sS'folder'
> p82
> S"'/home/sujith/Desktop/wcj/applications/init/'"
> p83
> sS'now'
> p84
> S'datetime.datetime(2010, 10, 9, 4, 21, 27, 744517)'
> p85
> sS'post_vars'
> p86
> S'<Storage {}>'
> p87
> ssS'frames'
> p88
> (lp89
> (dp90
> S'file'
> p91
> S'/home/sujith/Desktop/wcj/gluon/restricted.py'
> p92
> sS'dump'
> p93
> (dp94
> S'environment'
> p95
> S"{'A': <class 'gluon.html.A'>, 'B': <class 'gluon.html.B'>,
> 'BEAUTIFY': <class 'gluon.html.BEAUTIFY'>, 'BODY': <class
> 'gluon.html.BODY'>, 'BR': <class 'gluon.html.BR'>, 'CENTER': <class
> 'gluon.html.CENTER'>, 'CLEANUP': <class 'gluon.validators.CLEANUP'>,
> 'CODE': <class 'gluon.html.CODE'>, 'CRYPT': <class
> 'gluon.validators.CRYPT'>, 'DAL': <function DAL at 0xa719304>, ...}"
> p96
> sS'ccode'
> p97
> S'<code object <module> at 0xa8ddf50, file "/home/...init/controllers/
> default.py:viewcompany", line 8>'
> p98
> ssS'lnum'
> p99
> I188
> sS'lines'
> p100
> (dp101
> I192
> S'        # XXX Show exception in Wing IDE if running in debugger'
> p102
> sI183
> S'        if type(code) == types.CodeType:'
> p103
> sI184
> S'            ccode = code'
> p104
> sI185
> S'        else:'
> p105
> sI186
> S'            ccode = compile2(code,layer)'
> p106
> sI187
> g2
> sI188
> S'        exec ccode in environment'
> p107
> sI189
> S'    except HTTP:'
> p108
> sI190
> S'        raise'
> p109
> sI191
> S'    except Exception:'
> p110
> ssS'call'
> p111
> S'(code=<code object <module> at 0xa8ddf50, file "/home/...init/
> controllers/default.py:viewcompany", line 8>, environment={\'A\':
> <class \'gluon.html.A\'>, \'B\': <class \'gluon.html.B\'>, \'BEAUTIFY
> \': <class \'gluon.html.BEAUTIFY\'>, \'BODY\': <class \'gluon.html.BODY
> \'>, \'BR\': <class \'gluon.html.BR\'>, \'CENTER\': <class
> \'gluon.html.CENTER\'>, \'CLEANUP\': <class \'gluon.validators.CLEANUP
> \'>, \'CODE\': <class \'gluon.html.CODE\'>, \'CRYPT\': <class
> \'gluon.validators.CRYPT\'>, \'DAL\': <function DAL at
> 0xa719304>, ...}, layer=\'/home/sujith/Desktop/wcj/applications/init/
> controllers/default.py\')'
> p112
> sS'func'
> p113
> S'restricted'
> p114
> sa(dp115
> g91
> S'/home/sujith/Desktop/wcj/applications/init/controllers/
> default.py:viewcompany'
> p116
> sg93
> (dp117
> sg99
> I222
> sg100
> (dp118
> sg111
> S'()'
> p119
> sg113
> S'<module>'
> p120
> sa(dp121
> g91
> S'/home/sujith/Desktop/wcj/gluon/globals.py'
> p122
> sg93
> (dp123
> S'self'
> p124
> S'undefined'
> p125
> sS'f'
> p126
> S'<function viewcompany at 0xa8c879c>'
> p127
> ssg99
> I96
> sg100
> (dp128
> I96
> S'        self._caller = lambda f: f()'
> p129
> sI97
> S'        self._view_environment = None'
> p130
> sI98
> S'        self._custom_commit = None'
> p131
> sI99
> S'        self._custom_rollback = None'
> p132
> sI100
> g2
> sI91
> S"        self.flash = ''           # used by the default view layout"
> p133
> sI92
> S'        self.meta = Storage()     # used by web2py_ajax.html'
> p134
> sI93
> S'        self.menu = []            # used by the default view layout'
> p135
> sI94
> S'        self.files = []           # used by web2py_ajax.html'
> p136
> sI95
> S'        self._vars = None'
> p137
> ssg111
> S'(f=<function viewcompany at 0xa8c879c>)'
> p138
> sg113
> S'<lambda>'
> p139
> sa(dp140
> g91
> S'/home/sujith/Desktop/wcj/applications/init/controllers/
> default.py:viewcompany'
> p141
> sg93
> (dp142
> sg99
> I22
> sg100
> (dp143
> sg111
> S'()'
> p144
> sg113
> S'viewcompany'
> p145
> sa(dp146
> g91
> S'/home/sujith/Desktop/wcj/gluon/sql.py'
> p147
> sg93
> (dp148
> S'i'
> p149
> S'0'
> p150
> sS'self'
> p151
> S'<gluon.sql.Rows object at 0xa98896c>'
> p152
> sS'self.records'
> p153
> S'[]'
> p154
> sS'row'
> p155
> g125
> ssg99
> I3605
> sg100
> (dp156
> I3600
> S'        returns a list of sorted elements (not sorted in place)'
> p157
> sI3601
> S'        """'
> p158
> sI3602
> S'        return
> Rows(self.db,sorted(self,key=f,reverse=reverse),self.colnames)'
> p159
> sI3603
> g2
> sI3604
> S'    def __getitem__(self, i):'
> p160
> sI3605
> S'        row = self.records[i]'
> p161
> sI3606
> S'        keys = row.keys()'
> p162
> sI3607
> S"        if self.compact and len(keys) == 1 and keys[0] != '_extra':"
> p163
> sI3608
> S'            return row[row.keys()[0]]'
> p164
> sI3609
> S'        return row'
> p165
> ssg111
> S'(self=<gluon.sql.Rows object at 0xa98896c>, i=0)'
> p166
> sg113
> g19
> sasS'pyver'
> p167
> S'Python 2.5.5: /usr/bin/python2.5'
> p168
> sS'session'
> p169
> (dp170
> sS'etype'
> p171
> S"<type 'exceptions.IndexError'>"
> p172
> sS'date'
> p173
> S'Sat Oct  9 04:21:27 2010'
> p174
> sS'response'
> p175
> (dp176
> S'status'
> p177
> S'200'
> p178
> sg51
> S'<cStringIO.StringO object at 0xaa6c520>'
> p179
> sg66
> S"<SimpleCookie: session_id_init='1:c69a55b4-58b1-4d94-a89d-
> bc0229214182'>"
> p180
> sS'_vars'
> p181
> S'None'
> p182
> sS'_dbtable_and_field'
> p183
> S"('session_id_init', <Table {'client_ip': <gluon.contrib.gql.Field
> ob...: <gluon.contrib.gql.Field object at 0xaa69a6c>}>, '1',
> 'c69a55b4-58b1-4d94-a89d-bc0229214182')"
> p184
> sS'menu'
> p185
> S'[]'
> p186
> sS'flash'
> p187
> S"'Select companies from the lower right.'"
> p188
> sS'session_new'
> p189
> S'True'
> p190
> sS'_custom_rollback'
> p191
> S'None'
> p192
> sS'session_id'
> p193
> S"'1:c69a55b4-58b1-4d94-a89d-bc0229214182'"
> p194
> sS'headers'
> p195
> S"<Storage {'Expires': 'Sat, 09 Oct 2010 04:21:27 ...he, must-
> revalidate, post-check=0, pre-check=0'}>"
> p196
> sS'meta'
> p197
> S'<Storage {}>'
> p198
> sS'session_filename'
> p199
> S"'/home/sujith/Desktop/wcj/applications/init/sessions/
> 127-0-0-1-39a7f7f0-7ad5-4ec2-83ae-73923950fdac'"
> p200
> sS'postprocessing'
> p201
> S'[]'
> p202
> sS'_caller'
> p203
> S'<function <lambda> at 0xa98b10c>'
> p204
> sS'_view_environment'
> p205
> S"{'A': <class 'gluon.html.A'>, 'B': <class 'gluon.html.B'>,
> 'BEAUTIFY': <class 'gluon.html.BEAUTIFY'>, 'BODY': <class
> 'gluon.html.BODY'>, 'BR': <class 'gluon.html.BR'>, 'CENTER': <class
> 'gluon.html.CENTER'>, 'CLEANUP': <class 'gluon.validators.CLEANUP'>,
> 'CODE': <class 'gluon.html.CODE'>, 'CRYPT': <class
> 'gluon.validators.CRYPT'>, 'DAL': <function DAL at 0xa719304>, ...}"
> p206
> sS'session_id_name'
> p207
> S"'session_id_init'"
> p208
> sS'_custom_commit'
> p209
> S'None'
> p210
> sS'files'
> p211
> S'[]'
> p212
> sS'view'
> p213
> S"'default/viewcompany.html'"
> p214
> ssS'locals'
> p215
> (dp216
> g149
> g150
> sS'self'
> p217
> S'<gluon.sql.Rows object at 0xa98896c>'
> p218
> sssS'traceback'
> p219
> S'Traceback (most recent call last):\n  File "/home/sujith/Desktop/wcj/
> gluon/restricted.py", line 188, in restricted\n    exec ccode in
> environment\n  File "/home/sujith/Desktop/wcj/applications/init/
> controllers/default.py:viewcompany", line 222, in <module>\n  File "/
> home/sujith/Desktop/wcj/gluon/globals.py", line 96, in <lambda>\n
> self._caller = lambda f: f()\n  File "/home/sujith/Desktop/wcj/
> applications/init/controllers/default.py:viewcompany", line 22, in
> viewcompany\n  File "/home/sujith/Desktop/wcj/gluon/sql.py", line
> 3605, in __getitem__\n    row = self.records[i]\nIndexError: list
> index out of range\n'
> p220
> s.
> ******************************************
>
> Thanks
> Sujith
>
> On Oct 8, 11:45 pm, mdipierro <[email protected]> wrote:> On Oct 8, 
> 1:28 pm, Sujith <[email protected]> wrote:
>
> > > Hi Massimo,
>
> > > Thanks for the superfast response.
> > > The views and controllers seem to be working now. But i cannot see any
> > > data on the website.
>
> > can you explain which url shows the data and which one does not? This
> > is probably an application error.
>
> > > The appliance seems to be working fine and i can see the data when
> > > running under web2py.
>
> > > Thanks a lot. :)
> > > Sujith
>
> > > On Oct 8, 11:22 pm, mdipierro <[email protected]> wrote:
>
> > > > You should not have this line:
>
> > > >     from gluon.dal import *
>
> > > > that module is experimental and it is not the proper way of using it.
> > > > It does not support GAE at all.
>
> > > > If you remove that line everything else I see should work fine on GAE.
>
> > > > Massimo
>
> > > > On Oct 8, 1:20 pm, Sujith <[email protected]> wrote:
>
> > > > > Hi all,
>
> > > > > I am trying to make the "jobsite" appliance work on GAE. I edited  the
> > > > > model(db.py) of jobsite to suit GAE.
> > > > > I am getting the following error when running under devappserver of
> > > > > gae sdk.
> > > > > ***************************************
> > > > > WARNING  2010-10-08 18:10:40,069 datastore_file_stub.py:657] Could not
> > > > > read datastore data from /tmp/dev_appserver.datastore
> > > > > WARNING  2010-10-08 18:10:40,080 dev_appserver.py:3637] Could not
> > > > > initialize images API; you are likely missing the Python "PIL" module.
> > > > > ImportError: No module named _imaging
> > > > > INFO     2010-10-08 18:10:40,108 dev_appserver_main.py:431] Running
> > > > > application wcj on port 8080:http://localhost:8080
> > > > > WARNING  2010-10-08 18:12:29,440 portalocker.py:92] no file locking
> > > > > ERROR    2010-10-08 18:12:30,790 restricted.py:151] Traceback (most
> > > > > recent call last):
> > > > >   File "/home/sujith/Desktop/wcj/gluon/restricted.py", line 188, in
> > > > > restricted
> > > > >     exec ccode in environment
> > > > >   File "/home/sujith/Desktop/wcj/applications/init/models/db.py", line
> > > > > 7, in <module>
> > > > >     session.connect(request,response,db)
> > > > >   File "/home/sujith/Desktop/wcj/gluon/globals.py", line 298, in
> > > > > connect
> > > > >     migrate=table_migrate,
> > > > >   File "/home/sujith/Desktop/wcj/gluon/dal.py", line 2117, in
> > > > > define_table
> > > > >     t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > >   File "/home/sujith/Desktop/wcj/gluon/dal.py", line 2555, in _create
> > > > >     elif not field.type in self._db._adapter.types:
> > > > > AttributeError: 'BaseAdapter' object has no attribute 'types'
> > > > > *************************************
>
> > > > > This is the model
> > > > > *************************************
> > > > > import datetime
> > > > > now=datetime.datetime.today()
>
> > > > > if request.env.web2py_runtime_gae:
> > > > >     from gluon.dal import *
> > > > >     db = DAL('gae')
> > > > >     session.connect(request,response,db)
> > > > > else:
> > > > >     db = DAL('sqlite://storage.sqlite')
>
> > > > > db.define_table('user',
> > > > >                 Field('name'),
> > > > >                 Field('email'),
> > > > >                 Field('phone_country_code',default='1'),
> > > > >                 Field('phone'),
> > > > >                 Field('user_type'),
> > > > >                 Field('password','password'),
> > > > >                 Field('authorized',default='True'),
> > > > >                 Field('verification',default=''))
>
> > > > > db.user.name.requires=IS_NOT_EMPTY()
> > > > > db.user.user_type.requires=IS_IN_SET('Administrator','Applicant','Recruiter')
> > > > > db.user.email.requires=[IS_EMAIL(), IS_NOT_IN_DB(db,'user.email'),
> > > > > IS_NOT_EMPTY()]
>
> > > > > db.define_table('country',
> > > > >                 Field('country_code'),
> > > > >                 Field('country_name'))
>
> > > > > db.country.country_code.requires=IS_NOT_EMPTY()
> > > > > db.country.country_name.requires=IS_NOT_EMPTY()
>
> > > > > db.define_table('state',
> > > > >                 Field('country_code'),
> > > > >                 Field('state_code'),
> > > > >                 Field('state_name'))
>
> > > > > db.state.country_code.requires=IS_IN_DB(db,'country.country_code')
> > > > > db.state.state_code.requires=IS_NOT_EMPTY()
> > > > > db.state.state_name.requires=IS_NOT_EMPTY()
>
> > > > > db.define_table('company',
> > > > >                 Field('company_name'),
> > > > >                 Field('profile','text'),
> > > > >                 Field('address1'),
> > > > >                 Field('address2'),
> > > > >                 Field('city'),
> > > > >                 Field('state'),
> > > > >                 Field('zip'),
> > > > >                 Field('country'),
> > > > >                 Field('owner',db.user,default=session.user_id))
>
> > > > > db.company.company_name.requires=IS_NOT_EMPTY()
> > > > > db.company.profile.requires=IS_NOT_EMPTY()
> > > > > db.company.country.requires=IS_IN_DB(db,'country.country_name')
> > > > > db.company.owner.requires=IS_IN_DB(db,'user.id','%(name)s')
> > > > > db.company.state.requires=IS_IN_DB(db,'state.state_name')
> > > > > db.company.owner.requires=IS_NOT_EMPTY()
>
> > > > > db.define_table('categories',
> > > > >                 Field('cat_name'),
> > > > >                 Field('cat_descr','text'))
>
> > > > > db.categories.cat_name.requires=IS_NOT_EMPTY()
>
> > > > > db.define_table('positions',
> > > > >                 Field('company_name'),
> > > > >                 Field('title'),
> > > > >                 Field('category'),
> > > > >                 Field('description','text',default=''),
> > > > >                 Field('timestamp','datetime',default=now),
> > > > >                 Field('expires_on','datetime'),
> > > > >                 Field('access',default='Private'),
> > > > >                 Field('owner','integer',default=session.user_id))
>
> > > > > #db.positions.access.requires=IS_IN_SET('P','R','A')
> > > > > db.positions.company_name.requires=IS_IN_DB(db,'company.company_name')
> > > > > db.positions.category.requires=IS_IN_DB(db,'categories.cat_name')
> > > > > #db.positions.expires_on.requires=IS_NOT_EMPTY()
> > > > > db.company.owner.requires=IS_NOT_EMPTY()
>
> > > > > db.define_table('position_requirements',
> > > > >                 Field('position_id'),
> > > > >                 Field('requirement'))
>
> > > > > db.position_requirements.position_id.requires=IS_IN_DB(db,'positions.id','position.title')
>
> > > > > db.define_table('applicants',
> > > > >                 Field('user_id'),
> > > > >                 Field('applicant_name'),
> > > > >                 Field('address1'),
> > > > >                 Field('address2'),
> > > > >                 Field('city'),
> > > > >                 Field('state'),
> > > > >                 Field('zip'),
> > > > >                 Field('country'),
> > > > >                 Field('phone_country_code',default='1'),
> > > > >                 Field('phone'),
> > > > >                 Field('email'),
> > > > >                 Field('access',default='Public'),
> > > > >                 Field('updated','datetime',default=now))
>
> > > > > #db.applicants.access.requires=IS_IN_SET('P','R','A')
> > > > > db.applicants.applicant_name.requires=IS_NOT_EMPTY()
> > > > > db.applicants.email.requires=[IS_EMAIL(),IS_NOT_EMPTY()]
> > > > > db.applicants.country.requires=IS_IN_DB(db,'country.country_code','country.country_name')
> > > > > db.applicants.state.requires=IS_IN_DB(db,'state.state_code','state.state_name')
>
> > > > > db.define_table('applied_for',
> > > > >                 Field('position_id'),
> > > > >                 Field('applicant'),
> > > > >                 Field('applicant_name'),
> > > > >                 Field('applied','datetime',default=now))
>
> > > > > db.applied_for.position_id.requires=IS_IN_DB(db,'positions.id','positions.title')
> > > > > #db.applied_for.applicant.requires=IS_IN_DB(db,'applicants.id','applicants.id')
> > > > > #db.applied_for.applicant.requires=IS_IN_DB(db,'applicants.applicant_name','applicants.applicant_name')
>
> > > > > db.define_table('resumes',
> > > > >                 Field('user_id',db.user,default=session.user_id),
> > > > >                 Field('title'),
> > > > >                 Field('body','text'),
> > > > >                 Field('keywords','text'),
> > > > >                 Field('updated','datetime',default=now),
> > > > >                 Field('access',default='Public'))
>
> > > > > #db.resumes.access.requires=IS_IN_SET('P','R','A')
> > > > > db.resumes.user_id.requires=IS_NOT_EMPTY()
> > > > > ***************************************
>
> > > > > I am using python2.5 on Ubuntu 10.4 (lucid). I am a noob in python and
> > > > > also a newbie to web2py.
>
> > > > > Thanks for the help.
>
> > > > > Sujith
>
>

Reply via email to