Found this Was having trouble but i guess this -->  
https://docs.google.com/viewer?a=v&q=cache:v2lgkygxA_cJ:www.packtpub.com/sites/default/files/5467OS-Chapter-3-Database-Abstraction-Layer.pdf+&hl=en&pid=bl&srcid=ADGEESgEeuJ9YUV1Lwvy1CubPMg-92-ZM0Rtdvc14RQhuwGE32cSVmd-p35Tw21hW2R4PB9UcXbXLwTVrGRcthvusLvcdRDhnz8B2g-LsohKy64TyJcMX0yuCw5qiypnsPSxUyWHHoPT&sig=AHIEtbQPUlFmojpWCTBBJKHdwdR34aZeuw
 

explained it. DRY is broken however, which isn't a good thing as the 
database gets bigger.

On Saturday, July 7, 2012 2:15:58 PM UTC-4, Horus wrote:
>
> I currently have 2 apps which i would like to share one database.
>
> one app is for authentication the other is the main app.
> When I run the app1 it creates the auth tables along with another table 
> called *base_tags*
>
> when I run app2 I get the following error. (the base_tags table in app1 is 
> referenced in app2 - same database).
>
> *In App2*
> <type 'exceptions.KeyError'> 'base_tags'
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 205, in restricted
>     exec ccode in environment
>   File "C:/web2py/applications/app2/models/db.py" 
> <http://127.0.0.1:8000/admin/edit/histreet/models/db.py>, line 433, in 
> <module>
>     Field('tag_id', db.base_tags, label='Tag', required=True, notnull=True, 
> writable=False, readable=False)
>   File "C:\web2py\gluon\dal.py", line 6343, in __getattr__
>     return self[key]
>   File "C:\web2py\gluon\dal.py", line 6337, in __getitem__
>     return dict.__getitem__(self, str(key))
> KeyError: 'base_tags'
>
>
> db.define_table('places_tags',
>                 Field('place_id', db.places, label='Place', required=True, 
> notnull=True, writable=False, readable=False),
> *line 433*:    Field('tag_id', *db.base_tags*, label='Tag', 
> required=True, notnull=True, writable=False, readable=False)
>                 )
>
>
> I am assuming that place_tags isn't seeing db.base_tags (no reference). 
> May be I don't understand DAL.
>
> 1. Isn't DAL an interface to the database? 
> 2. If the database exist why wouldn't I be able to access it from another 
> app and reference tables that already exist?
> 3. Should I assume that unless *base_tags* was defined in app2 I cannot 
> access it?
>
>

Reply via email to