server/schemaserial.py
branchstable
changeset 3854 8633cd05b6b5
parent 3689 deb13e88e037
child 3857 6676a839dc97
equal deleted inserted replaced
3853:e8af6f586882 3854:8633cd05b6b5
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     7 """
     7 """
     8 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
     9 
     9 
       
    10 import os
    10 import sys
    11 import sys
    11 from itertools import chain
    12 from itertools import chain
    12 
    13 
    13 from logilab.common.shellutils import ProgressBar
    14 from logilab.common.shellutils import ProgressBar
    14 
    15 
   278     """
   279     """
   279     _title = '-> storing the schema in the database '
   280     _title = '-> storing the schema in the database '
   280     print _title,
   281     print _title,
   281     eschemas = schema.entities()
   282     eschemas = schema.entities()
   282     aller = eschemas + schema.relations()
   283     aller = eschemas + schema.relations()
   283     if not verbose:
   284     if not verbose and not os.environ.get('APYCOT_ROOT'):
   284         pb_size = len(aller) + len(CONSTRAINTS) + len([x for x in eschemas if x.specializes()])
   285         pb_size = len(aller) + len(CONSTRAINTS) + len([x for x in eschemas if x.specializes()])
   285         pb = ProgressBar(pb_size, title=_title)
   286         pb = ProgressBar(pb_size, title=_title)
   286     rql = 'INSERT CWConstraintType X: X name %(ct)s'
   287     rql = 'INSERT CWConstraintType X: X name %(ct)s'
   287     for cstrtype in CONSTRAINTS:
   288     for cstrtype in CONSTRAINTS:
   288         if verbose:
   289         if verbose: