Hi,

Cache has been moved to trytond.cache:
http://hg.tryton.org/trytond/rev/bab7bc7efaea

Use 'from trytond.cache import Cache' and it should work again.


Am Dienstag, den 30.11.2010, 22:41 -0800 schrieb Mohammad:
> I used to import Trytond using below code, It always worked fine
> without any error.
> But since version 1.7 and now 1.8 , New error message has been shown.
> This is the error message in python code:
> ===========================================================
> 
>   File "/home/mohammad/.pycrust/startup", line 13, in <module>
>     from trytond.tools import Cache
> ImportError: cannot import name Cache
> 
> 
> 
> And here is the script which is being used by me in PyCrust .
> ===========================================================
> 
> import sys, os
> sys.path.append('/home/mohammad/workspace/tryton-dist/trytond1.6/
> trytond/')
> 
> 
> import logging
> logging.basicConfig(level=logging.FATAL)
> 
> from trytond.config import CONFIG
> CONFIG.load()
> from trytond.modules import register_classes
> from trytond.pool import Pool
> from trytond.backend import Database
> from trytond.tools import Cache
> 
> # Register classes populates the pool of models:
> register_classes()
> 
> # dbname contains the db you want to use
> DBNAME = 'mohammad_test'
> # Instantiate the database and the pool
> DB = Database(DBNAME).connect()
> POOL = Pool(DBNAME)
> POOL.init()
> 
> # Get a cursor on the database
> cursor = DB.cursor()
> # Clean the global cache for multi-instance
> Cache.clean(DBNAME)
> 
> # User 0 is root user. We use it to get the admin id:
> user_obj = POOL.get('res.user')
> user = user_obj.search(cursor, 0, [
>         ('login', '=', 'admin'),
>         ], limit=1)[0]
> print "the admin id is: " + str(user)
> 
> 
> ===================================================
> does anybody have an idea about that ?
> 

-- 
Korbinian Preisler
____________________________________
virtual things
Preisler & Spallek GbR
Munich - Aix-la-Chapelle

Windeckstr. 77
81375 Munich - Germany
Tel: +49 (89) 710 481 55
Fax: +49 (89) 710 481 56

[email protected]
http://www.virtual-things.biz

-- 
[email protected] mailing list

Reply via email to