rif / web2admin

web2py administration plugin
26 stars 10 forks source link

Object has no attribute id #4

Closed mdipierro closed 12 years ago

mdipierro commented 12 years ago

I applied the plugins to a simple barebone app with just def index(); return wiki.auth() and I get:

Traceback (most recent call last): File "/Users/massimodipierro/Dropbox/web2py/gluon/restricted.py", line 209, in restricted exec ccode in environment File "/Users/massimodipierro/Dropbox/web2py/applications/cocineros/controllers/plugin_web2admin.py", line 102, in File "/Users/massimodipierro/Dropbox/web2py/gluon/globals.py", line 186, in self._caller = lambda f: f() File "/Users/massimodipierro/Dropbox/web2py/gluon/tools.py", line 2812, in f return action(_a, *_b) File "/Users/massimodipierro/Dropbox/web2py/applications/cocineros/controllers/plugin_web2admin.py", line 31, in history logs = w2a_def_db(w2a_history).select(orderby=~w2a_history.id)[:5] AttributeError: 'NoneType' object has no attribute 'id'

rif commented 12 years ago

I cannot reproduce this issue: the problem seems to be that the w2a_history is None but the w2a_history is defined in the conditional model as w2a_history = w2a_def_db.define_table('plugin_web2admin_history', ...

I wonder how can that get as None in your case?

What I did to reproduce the issue is:

Can you send me the zipped app?

mdipierro commented 12 years ago

What is your email address?

On Sep 17, 2012, at 5:36 AM, Radu Ioan Fericean wrote:

I cannot reproduce this issue: the problem seems to be that the w2a_history is None but the w2a_history is defined in the conditional model as w2a_history = w2a_def_db.define_table('plugin_web2admin_history', ...

I wonder how can that get as None in your case?

What I did to reproduce the issue is:

update web2py from trunk created a new app with def index(): return auth.wiki() installed web2admin from here: https://github.com/downloads/rif/web2admin/web2py.plugin.web2admin.w2p accessed http://localhost:8000/w2a/web2admin Can you send me the zipped app?

— Reply to this email directly or view it on GitHub.

rif commented 12 years ago

radu@fericean.ro

rif commented 12 years ago

Fixed issue but it was quite strange:

a = db.define_table('test',...)

a is None

had to change to:

a = db.test

mdipierro commented 12 years ago

Now I see. This is because of lazy_tables=True. It makes define_table return None (since the actually table is not defined there any more).

On Sep 17, 2012, at 2:01 PM, Radu Ioan Fericean wrote:

Fixed issue but it was quite strange:

a = db.define_table('test',...)

a is None

had to change to:

a = db.test

— Reply to this email directly or view it on GitHub.

rif commented 12 years ago

Ah, I see. I will have to look more on the lazy table concept.

I discovered some other issue with the layouts on the project that you gave me. I am working on them right now.

-rif

On Mon, Sep 17, 2012 at 10:27 PM, mdipierro notifications@github.comwrote:

Now I see. This is because of lazy_tables=True. It makes define_table return None (since the actually table is not defined there any more).

On Sep 17, 2012, at 2:01 PM, Radu Ioan Fericean wrote:

Fixed issue but it was quite strange:

a = db.define_table('test',...)

a is None

had to change to:

a = db.test

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/rif/web2admin/issues/4#issuecomment-8627649.

rif commented 12 years ago

The layout issue should be fixed as well. Please let me know any other issues you encounter, there are not many testers yet.

Thank you, -rif

On Mon, Sep 17, 2012 at 10:30 PM, fericean@gmail.com fericean@gmail.comwrote:

Ah, I see. I will have to look more on the lazy table concept.

I discovered some other issue with the layouts on the project that you gave me. I am working on them right now.

-rif

On Mon, Sep 17, 2012 at 10:27 PM, mdipierro notifications@github.comwrote:

Now I see. This is because of lazy_tables=True. It makes define_table return None (since the actually table is not defined there any more).

On Sep 17, 2012, at 2:01 PM, Radu Ioan Fericean wrote:

Fixed issue but it was quite strange:

a = db.define_table('test',...)

a is None

had to change to:

a = db.test

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/rif/web2admin/issues/4#issuecomment-8627649.

mdipierro commented 12 years ago

Thank you rif. On Sep 17, 2012, at 2:46 PM, Radu Ioan Fericean wrote:

The layout issue should be fixed as well. Please let me know any other issues you encounter, there are not many testers yet.

Thank you, -rif

On Mon, Sep 17, 2012 at 10:30 PM, fericean@gmail.com fericean@gmail.comwrote:

Ah, I see. I will have to look more on the lazy table concept.

I discovered some other issue with the layouts on the project that you gave me. I am working on them right now.

-rif

On Mon, Sep 17, 2012 at 10:27 PM, mdipierro notifications@github.comwrote:

Now I see. This is because of lazy_tables=True. It makes define_table return None (since the actually table is not defined there any more).

On Sep 17, 2012, at 2:01 PM, Radu Ioan Fericean wrote:

Fixed issue but it was quite strange:

a = db.define_table('test',...)

a is None

had to change to:

a = db.test

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/rif/web2admin/issues/4#issuecomment-8627649.

— Reply to this email directly or view it on GitHub.