Re: [web2py] db.Table in appadmin when used in a module

2012-03-02 Thread Johann Spies
On 1 March 2012 16:15, Bruce Wade  wrote:

> Ummm where are you creating your object? In db.py? Or only in actions that
> require it? If only in actions that require it you will also need to import
> it and create an instance in the appadmin file.
>

I think my previous email(s) on this subject contain probably the answers
to you questions.  The db.Table object was created in a model, used in a
module to create a table and that module-class was initiated in appadmin
(as in the my own controller where everything works without a problem).

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] db.Table in appadmin when used in a module

2012-03-01 Thread Bruce Wade
Ummm where are you creating your object? In db.py? Or only in actions that
require it? If only in actions that require it you will also need to import
it and create an instance in the appadmin file.

On Wed, Feb 29, 2012 at 10:56 PM, Johann Spies wrote:

> On 1 March 2012 08:26, Bruce Wade  wrote:
>
>> Have you tried setting:
>>
>> def __init__(self, db):
>>self.signature = current.akb_signature_uuid
>>
>> then using self.signature?
>>
>>
>>
> Yes I had something similar and for some reason which I do not understand
> the code complained:
>
> AttributeError: 'Inst' object has no attribute 'signature'
>
> Regards
> Johann
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] db.Table in appadmin when used in a module

2012-02-29 Thread Johann Spies
On 1 March 2012 08:26, Bruce Wade  wrote:

> Have you tried setting:
>
> def __init__(self, db):
>self.signature = current.akb_signature_uuid
>
> then using self.signature?
>
>
>
Yes I had something similar and for some reason which I do not understand
the code complained:

AttributeError: 'Inst' object has no attribute 'signature'

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] db.Table in appadmin when used in a module

2012-02-29 Thread Bruce Wade
Have you tried setting:

def __init__(self, db):
   self.signature = current.akb_signature_uuid

then using self.signature?

On Wed, Feb 29, 2012 at 10:21 PM, Johann Spies wrote:

>
>
> On 29 February 2012 16:28, Bruce Wade  wrote:
>
>> Is there any reason you have a extra comma in the __init__ method?
>> def __init__(self, db*,*):
>>
>>
>>
> Well spotted.  No. It was a typo.  I have removed it now, but that did not
> change the behaviour of appadmin.
>
> Regards
> Johann
>
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] db.Table in appadmin when used in a module

2012-02-29 Thread Johann Spies
On 29 February 2012 16:28, Bruce Wade  wrote:

> Is there any reason you have a extra comma in the __init__ method?
> def __init__(self, db*,*):
>
>
>
Well spotted.  No. It was a typo.  I have removed it now, but that did not
change the behaviour of appadmin.

Regards
Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] db.Table in appadmin when used in a module

2012-02-29 Thread Bruce Wade
Is there any reason you have a extra comma in the __init__ method?
def __init__(self, db*,*):

On Wed, Feb 29, 2012 at 3:14 AM, Johann Spies wrote:

> On 29 February 2012 12:05, Bruno Rocha  wrote:
>
>> where the akb_signature_uuid is defined?
>>
>> in a model or module
>>
>
> model
>
>> from gluon import current
>> current.akb_signature_uuid = akb_signature_uuid = something
>>
>  In the model I have
>
> from gluon import current
> current.db = db
> current.akb_signature_uuid = akb_signature_uuid
>
>
>
>  then in appadmin
>>
>> from gluon import current
>>
>> does not works¿
>>
> No not even after adding
>
> akb_signature_uuid = current.akb_signature_uuid in 'get_databases(request)'
>
>
> Regards
> Johann
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] db.Table in appadmin when used in a module

2012-02-29 Thread Johann Spies
On 29 February 2012 12:05, Bruno Rocha  wrote:

> where the akb_signature_uuid is defined?
>
> in a model or module
>

model

> from gluon import current
> current.akb_signature_uuid = akb_signature_uuid = something
>
 In the model I have

from gluon import current
current.db = db
current.akb_signature_uuid = akb_signature_uuid



then in appadmin
>
> from gluon import current
>
> does not works¿
>
No not even after adding

akb_signature_uuid = current.akb_signature_uuid in 'get_databases(request)'

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] db.Table in appadmin when used in a module

2012-02-29 Thread Bruno Rocha
where the akb_signature_uuid is defined?

in a model or module

from gluon import current
current.akb_signature_uuid = akb_signature_uuid = something

then in appadmin

from gluon import current

does not works¿

http://zerp.ly/rochacbruno
Em 29/02/2012 06:26, "Johann Spies"  escreveu:

> I have this in a model. It is included in many tables.
>
> akb_signature = db.Table(db, 'akb_signature',
>  Field('created_on', 'datetime', default = request.now,
>readable = False, writable = False),
>  Field('created_by', db.auth_user, default =
> auth.user_id,
>readable = False, writable = False),
>  Field('updated_on', 'datetime', default = request.now,
>readable = False, writable = False),
>  Field('updated_by', db.auth_user, update =
> auth.user_id,
>readable = False, writable = False)
>  )
>
> While migrating table definitions to modules I used it in this way:
>
> class Inst(object):
>
> def __init__(self, db,):
> self.db = db
> self.T = current.T
> self.auth = current.session.auth
> self.tabelle = ["institution", 'inst_altername']
> self.define_tables()
>
> def define_tables(self):
> for tbl in self.tabelle:
> if tbl not in self.db.tables:
> if tbl == 'inst_altername':
> self.inst_alt()
> elif tbl == 'institution':
> self.institution()
> else:
> pass
>
> def institution(self):
> table = self.db.define_table('institution',
>  Field('name'),
> ... several other fields
>  current.akb_signature_uuid
>  )
>
> In appadmin I have:
>
>  t = Inst(db)
>
> and it shows the table but when I edit it or insert a new record I get a
> ticket:
>
> KeyError: 'akb_signature_uuid'
>
> So how do I expose akb_signature_uuid in this case to appadmin?
>
> Regards
> Johann
> --
>
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>