I take this back. I believe I need to pass comment ids instead of string.

On Sunday, May 10, 2015 at 12:11:25 PM UTC-4, Ron Chatterjee wrote:
>
>  I will. Thanks Paolo.
>
> Regards,
> Ron
>
>
>
> On Sunday, May 10, 2015 at 11:49:37 AM UTC-4, Paolo Valleri wrote:
>>
>> Hi Ron, please open an issue on https://github.com/web2py/pydal/issues
>> it seems that mongo adapter doesn't support "list:reference table" yet
>>
>> On Sunday, May 10, 2015 at 4:09:51 PM UTC+2, Ron Chatterjee wrote:
>>>
>>> I have the following in model. I get an error invalide literal for int 
>>> when I add the line Field("comments", "list: reference comment"). Otherwise 
>>> it works fine
>>>
>>> db.define_table('Post',
>>>
>>>                 Field('author'),
>>>
>>>                 Field('content','Text'),
>>>
>>>                 Field("tags","list:string"),
>>>
>>>                 Field("comments","list:reference comment"),
>>>
>>>                 Field('date', 'datetime',default=request.now))
>>>
>>>
>>>  db.define_table("comment",
>>>
>>>                 Field("created_on","datetime",default=request.now),
>>>
>>>                 Field("body","text"),
>>>
>>>                 Field("author","reference auth_user"))
>>>
>>> posts = db._adapter.connection.posts_three
>>>
>>>
>>>
>>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>
>>> Below is the error I get.
>>>
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>> 18.
>>> 19.
>>> 20.
>>>
>>> Traceback (most recent call last):
>>>   File "C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\restricted.py", 
>>> line 227, in restricted
>>>     exec ccode in environment
>>>   File 
>>> "C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py"
>>>  
>>> <http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py>,
>>>  line 704, in <module>
>>>   File "C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\globals.py", line 
>>> 393, in <lambda>
>>>     self._caller = lambda f: f()
>>>   File 
>>> "C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py"
>>>  
>>> <http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py>,
>>>  line 151, in insert
>>>     if form.accepts(request.vars, session):
>>>   File "C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\sqlhtml.py", line 
>>> 1679, in accepts
>>>     self.vars.id = self.table.insert(**fields)
>>>   File 
>>> "C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\objects.py",
>>>  line 737, in insert
>>>     ret =  self._db._adapter.insert(self, self._listify(fields))
>>>   File 
>>> "C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py",
>>>  line 359, in insert
>>>     values[fieldname] = self.represent(v, fieldtype)
>>>   File 
>>> "C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py",
>>>  line 146, in represent
>>>     value = NoSQLAdapter.represent(self, obj, fieldtype)
>>>   File 
>>> "C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\base.py",
>>>  line 1795, in represent
>>>     return map(int,obj)
>>> ValueError: invalid literal for int() with base 10: 'comment one'
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to