50 | | This occurs on MySQL (sqlite fine) |
51 | | (=>Dominic) |
52 | | {{{ |
53 | | Traceback (most recent call last): |
54 | | File "gluon/restricted.py", line 186, in restricted |
55 | | exec ccode in environment |
56 | | File "/home/web2py/applications/eden/controllers/gis.py", line 1673, in <module> |
57 | | File "gluon/globals.py", line 96, in <lambda> |
58 | | self._caller = lambda f: f() |
59 | | File "/home/web2py/applications/eden/controllers/gis.py", line 492, in location |
60 | | output = shn_rest_controller(module, resource) |
61 | | File "/home/web2py/applications/eden/models/01_crud.py", line 1892, in shn_rest_controller |
62 | | output = res.execute_request(req, **attr) |
63 | | File "applications/eden/modules/s3xrc.py", line 893, in execute_request |
64 | | output = handler(r, **attr) |
65 | | File "/home/web2py/applications/eden/models/01_crud.py", line 1159, in shn_list |
66 | | next=r.there()) |
67 | | File "gluon/tools.py", line 2811, in create |
68 | | deletable=False, |
69 | | File "gluon/tools.py", line 2764, in update |
70 | | callback(onaccept,form,table._tablename) |
71 | | File "gluon/tools.py", line 48, in callback |
72 | | [action(form) for action in actions] |
73 | | File "/home/web2py/applications/eden/models/01_crud.py", line 1145, in <lambda> |
74 | | onaccept(form) |
75 | | File "/home/web2py/applications/eden/models/03_gis.py", line 503, in gis_location_onaccept |
76 | | name_dummy_element.onaccept(db, session.rcvars.gis_location, request) |
77 | | File "applications/eden/modules/widgets.py", line 217, in onaccept |
78 | | json_request = json_request ) |
79 | | File "applications/eden/modules/widgets.py", line 321, in _process_json |
80 | | id = json_table.insert(**json_record) |
81 | | File "gluon/sql.py", line 2003, in insert |
82 | | self._db._execute(query) |
83 | | File "gluon/sql.py", line 978, in <lambda> |
84 | | self._execute = lambda *a, **b: self._cursor.execute(*a, **b) |
85 | | File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166, in execute |
86 | | self.errorhandler(self, exc, value) |
87 | | File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line 35, in defaulterrorhandler |
88 | | raise errorclass, errorvalue |
89 | | IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`sahana/gis_location_name`, CONSTRAINT `gis_location_name_ibfk_1` |
90 | | }}} |
91 | | Seems like the location_id isn't yet in the DB when the name_dummy_element.onaccept(db, session.rcvars.gis_location, request) attempts to update the link_table. |
92 | | |
93 | | NB These files are fully in-sync with the [https://code.launchpad.net/~michael-howden/sahana-eden/adpc ADPC branch] which works: |
94 | | * modules/widgets.py: line 156 class JSON and class S3MultiSelectWidget |
95 | | * static/scripts/s3/s3.multiselect.widget.js |
96 | | * static/styles/s3/s3.multiselect.widget.css |
97 | | * This function also needed syncing: shn_split_multi_value() in {{{modules/s3utils.py}}}, but still no joy |
98 | | |
99 | | This error occurs when looking at the gis_location table in Appadmin (Raw DB access) on a sqlite version with data there unless the .represent is commented out ({{{models/03_gis.py +503}}}): |
100 | | {{{ |
101 | | Traceback (most recent call last): |
102 | | File "C:\Bin\web2py\gluon\restricted.py", line 186, in restricted |
103 | | exec ccode in environment |
104 | | File "C:\Bin\web2py\applications\eden/views\admin/appadmin.html", line 277, in <module> |
105 | | File "C:\Bin\web2py\gluon\sqlhtml.py", line 1175, in __init__ |
106 | | r = field.represent(r) |
107 | | File "C:\Bin\web2py\applications\eden\modules\widgets.py", line 589, in represent |
108 | | row = db(link_table.id == id).select() |
109 | | File "C:\Bin\web2py\gluon\sql.py", line 2546, in __eq__ |
110 | | return Query(self, '=', value) |
111 | | File "C:\Bin\web2py\gluon\sql.py", line 2988, in __init__ |
112 | | right = sql_represent(right, left.type, left._db._dbname, left._db._db_codec) |
113 | | File "C:\Bin\web2py\gluon\sql.py", line 553, in sql_represent |
114 | | return str(int(obj)) |
115 | | ValueError: invalid literal for int() with base 10: 'name_l10n' |
116 | | }}} |
117 | | |
118 | | * name_l10n field is empty |
119 | | * name_dummy field is a string that looks like a dict: |
120 | | * Punjab is: "{'name_l10n':'\xd9\xbe\xd9\x86\xd8\xac\xd8\xa7\xd8\xa8','language':'Urdu'}" |
121 | | * the gis_location_name table doesn't seem to be needed? |
| 50 | Fixed :) |