dataimport.py
changeset 9463 d62e13eba033
parent 9450 af4b93bc38a5
child 9478 2d7521881d3d
equal deleted inserted replaced
9462:375fc1868b11 9463:d62e13eba033
     1 # -*- coding: utf-8 -*-
     1 # -*- coding: utf-8 -*-
     2 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     4 #
     4 #
     5 # This file is part of CubicWeb.
     5 # This file is part of CubicWeb.
     6 #
     6 #
     7 # CubicWeb is free software: you can redistribute it and/or modify it under the
     7 # CubicWeb is free software: you can redistribute it and/or modify it under the
   936                                      self.rschema(rtype).inlined, **kwargs)
   936                                      self.rschema(rtype).inlined, **kwargs)
   937 
   937 
   938     def drop_indexes(self, etype):
   938     def drop_indexes(self, etype):
   939         """Drop indexes for a given entity type"""
   939         """Drop indexes for a given entity type"""
   940         if etype not in self.indexes_etypes:
   940         if etype not in self.indexes_etypes:
   941             cu = self.session.cnxset['system']
   941             cu = self.session.cnxset.cu
   942             def index_to_attr(index):
   942             def index_to_attr(index):
   943                 """turn an index name to (database) attribute name"""
   943                 """turn an index name to (database) attribute name"""
   944                 return index.replace(etype.lower(), '').replace('idx', '').strip('_')
   944                 return index.replace(etype.lower(), '').replace('idx', '').strip('_')
   945             indices = [(index, index_to_attr(index))
   945             indices = [(index, index_to_attr(index))
   946                        for index in self.source.dbhelper.list_indices(cu, etype)
   946                        for index in self.source.dbhelper.list_indices(cu, etype)