Feedback from django-roa module

48 views
Skip to first unread message

David Larlet

unread,
Jan 19, 2009, 12:43:07 PM1/19/09
to django-d...@googlegroups.com
Hello,

I'll try to sum up my main issues with Django, trying to add a Django
ROA/WOA/SOA/BuzzwordOA module which uses a custom backend in order to
access remote resources in a RESTful way. Basically, it calls URLs
instead of hitting database (a picture is worth a thousand words, look
at the schema here: http://welldev.org/django-roa-diagram.png for
details).

My first attempt was to create my own backend (as Oracle one) but it
eventually looks way too complicated (I don't need all SQL machinery)
and I end up with my own Model/Manager classes. I planed to use Meta
class in order to add resource URL but I can't because of Meta's
restriction:
http://code.djangoproject.com/browser/django/trunk/django/db/models/options.py#L89
Eventually, I use a static method because it's easier but I don't know
if this restriction is worth the pain.

I got an issue with M2M relations because SQL is hardcoded and I can't
catch it in Query(Set) object: http://code.djangoproject.com/browser/django/trunk/django/db/models/fields/related.py#L428
It is/will be an issue for all non-sql backend (CouchDB for instance)
and I think it should be fixed. Otherwise, I'll need to hack a large
part of Django just to support those relations.

Integrating auth is not as hard as I thought thanks to inheritance, I
just wrote my own remoteauth app and it works. Great. On the other
side, integrating admin is more complicated. The main issues come from
integrated ContentTypes (I'm still thinking about an elegant way to
handle that) and hardcoded way to retrieve objects:
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L584
A get_object method on ModelAdmin can solve this issue. In the same
attempt, it's useful to be able to easily change the ChangeList class
in order to customize url_for_result (for instance), it'll be solved
once #9749 is commited. I'm sure people involved in composite PKs #373
will agree with me :)

I hope it will not be considered as a rant, my English is pretty basic
but I just want to discuss those issues in order to help the community.

Regards,
David Larlet

#9749 http://code.djangoproject.com/ticket/9749
#373 http://code.djangoproject.com/ticket/373

Harryanto Ie

unread,
Jan 20, 2009, 10:08:13 PM1/20/09
to django-d...@googlegroups.com
hello, i found this error when i login with django admin :

MOD_PYTHON ERROR

ProcessId: 3848
Interpreter: 'localhost'

ServerName: 'localhost'
DocumentRoot: 'C:/xampp/htdocs'

URI: '/mytest/'
Location: '/mytest/'
Directory: None
Filename: 'C:/xampp/htdocs/mytest/'
PathInfo: ''

Phase: 'PythonHandler'
Handler: 'django.core.handlers.modpython'

Traceback (most recent call last):

File
"C:\Python25\Lib\site-packages\mod_python\importer.py",
line 1537, in HandlerDispatch
default=default_handler, arg=req,
silent=hlist.silent)

File
"C:\Python25\Lib\site-packages\mod_python\importer.py",
line 1229, in _process_target
result = _execute_target(config, req, object, arg)

File
"C:\Python25\Lib\site-packages\mod_python\importer.py",
line 1128, in _execute_target
result = object(arg)

File
"c:\python25\Lib\site-packages\django\core\handlers\modpython.py",
line 222, in handler
return ModPythonHandler()(req)

File
"c:\python25\Lib\site-packages\django\core\handlers\modpython.py",
line 199, in __call__
response = middleware_method(request, response)

File
"c:\python25\Lib\site-packages\django\contrib\sessions\middleware.py",
line 33, in process_response
request.session.save()

File
"c:\python25\Lib\site-packages\django\contrib\sessions\backends\db.py",
line 52, in save
session_key = self.session_key,

File
"c:\python25\Lib\site-packages\django\contrib\sessions\backends\base.py",
line 152, in _get_session_key
self._session_key = self._get_new_session_key()

File
"c:\python25\Lib\site-packages\django\contrib\sessions\backends\base.py",
line 144, in _get_new_session_key
if not self.exists(session_key):

File
"c:\python25\Lib\site-packages\django\contrib\sessions\backends\db.py",
line 25, in exists
Session.objects.get(session_key=session_key)

File
"c:\python25\Lib\site-packages\django\db\models\manager.py",
line 93, in get
return self.get_query_set().get(*args, **kwargs)

File
"c:\python25\Lib\site-packages\django\db\models\query.py",
line 298, in get
num = len(clone)

File
"c:\python25\Lib\site-packages\django\db\models\query.py",
line 154, in __len__
self._result_cache = list(self.iterator())

File
"c:\python25\Lib\site-packages\django\db\models\query.py",
line 269, in iterator
for row in self.query.results_iter():

File
"c:\python25\Lib\site-packages\django\db\models\sql\query.py",
line 206, in results_iter
for rows in self.execute_sql(MULTI):

File
"c:\python25\Lib\site-packages\django\db\models\sql\query.py",
line 1700, in execute_sql
cursor.execute(sql, params)

File
"c:\python25\Lib\site-packages\django\db\backends\util.py",
line 19, in execute
return self.cursor.execute(sql, params)

File
"c:\python25\Lib\site-packages\django\db\backends\sqlite3\base.py",
line 167, in execute
return Database.Cursor.execute(self, query, params)

OperationalError: no such table: django_session

i've put django.contrib.session into INSTALLEDD_APPS
and when i syncdb, table django_session has created.
what should i do?
============================================================================================================================
"Flexi - Gratis bicara sepanjang waktu se-Jawa Barat, Banten dan DKI Jakarta."

"Speedy - Gratis internetan unlimited dari pkl. 20.00 s/d 08.00 se-Jabodetabek, Banten, Karawang dan Purwakarta."
============================================================================================================================
“Nikmati akses TelkomNet Instan Week End Net hanya Rp 1.000/jam. Berlaku untuk Sabtu-Minggu, khusus Jawa Tengah dan DIY s/d

31 Desember 2008”.
============================================================================================================================
"Kini telah hadir Protector, layanan keamanan online yang dapat digunakan langsung saat menjelajahi internet kapan saja dan

di mana saja. Dapatkan secara GRATIS layanan Protector hingga 31 Desember 2008. Klik ke: http://protector.telkomspeedy.com".

============================================================================================================================

Ikuti Speedy Blogging Competition 2008, ajang kompetisi Blog yang terbuka bagi semua Blogger dengan tema: Seperti Apa Konten Hebat Menurutmu? Dapatkan hadiah utama 1 Buah Notebook Mininote. Informasi lebih lanjut kunjungi http://lomba.blog.telkomspeedy.com

Karen Tracey

unread,
Jan 20, 2009, 10:14:51 PM1/20/09
to django-d...@googlegroups.com
On Tue, Jan 20, 2009 at 10:08 PM, Harryanto Ie <harryanto.ie@telkom.net> wrote:
[snip]  
File
"c:\python25\Lib\site-packages\django\db\backends\sqlite3\base.py",
line 167, in execute
    return Database.Cursor.execute(self, query, params)

OperationalError: no such table: django_session

i've put django.contrib.session into INSTALLEDD_APPS
and when i syncdb, table django_session has created.
what should i do?

You should post this question on django-users:

http://groups.google.com/group/django-users

where it belongs.  This list is for development of Django itself, not user questions, as you have been told several times.  Please try to use the correct list.  Thank you.

Karen

Russell Keith-Magee

unread,
Jan 20, 2009, 10:35:50 PM1/20/09
to django-d...@googlegroups.com
On Wed, Jan 21, 2009 at 12:14 PM, Karen Tracey <kmtr...@gmail.com> wrote:
> On Tue, Jan 20, 2009 at 10:08 PM, Harryanto Ie <harrya...@telkom.net>

I would add that this is the second time in two days you have been
reminded about the purpose of Django-developers. You were also warned
- twice - on the 16th of January.

If you persist in posting user queries to the developers mailing list,
we will be forced to ban you from the developers list.

I would also like to use this opportunity to _beg_ you - again - to
_please_ trim your signature.

Yours,
Russ Magee %-)

David Larlet

unread,
Jan 23, 2009, 12:42:06 PM1/23/09
to django-d...@googlegroups.com
Le 19 janv. 09 à 18:43, David Larlet a écrit :

> I got an issue with M2M relations because SQL is hardcoded and I
> can't catch it in Query(Set) object: http://code.djangoproject.com/browser/django/trunk/django/db/models/fields/related.py#L428
> It is/will be an issue for all non-sql backend (CouchDB for
> instance) and I think it should be fixed. Otherwise, I'll need to
> hack a large part of Django just to support those relations.

Given the amount of answers :) let's discuss a concrete
implementation, I just submitted a ticket #10109 about that and I'd
love to know your thoughts about the design of the patch (no
documentation nor tests for now, for the moment it just works for my
project).

Regards,
David

http://code.djangoproject.com/ticket/10109
http://code.djangoproject.com/attachment/ticket/10109/patch_django_10109.20090123.diff

Reply all
Reply to author
Forward
0 new messages