misc/migration/postcreate.py
changeset 10589 7c23b7de2b8d
parent 10473 23a2fa8cb725
child 10684 7e9c9a32f24f
equal deleted inserted replaced
10588:fdaa0e4b7eaf 10589:7c23b7de2b8d
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """cubicweb post creation script, set user's workflow"""
    18 """cubicweb post creation script, set user's workflow"""
       
    19 from __future__ import print_function
    19 
    20 
    20 # insert versions
    21 # insert versions
    21 create_entity('CWProperty', pkey=u'system.version.cubicweb',
    22 create_entity('CWProperty', pkey=u'system.version.cubicweb',
    22               value=unicode(config.cubicweb_version()))
    23               value=unicode(config.cubicweb_version()))
    23 for cube in config.cubes():
    24 for cube in config.cubes():
    44 
    45 
    45 # create anonymous user if all-in-one config and anonymous user has been specified
    46 # create anonymous user if all-in-one config and anonymous user has been specified
    46 if hasattr(config, 'anonymous_user'):
    47 if hasattr(config, 'anonymous_user'):
    47     anonlogin, anonpwd = config.anonymous_user()
    48     anonlogin, anonpwd = config.anonymous_user()
    48     if anonlogin == session.user.login:
    49     if anonlogin == session.user.login:
    49         print 'you are using a manager account as anonymous user.'
    50         print('you are using a manager account as anonymous user.')
    50         print 'Hopefully this is not a production instance...'
    51         print('Hopefully this is not a production instance...')
    51     elif anonlogin:
    52     elif anonlogin:
    52         from cubicweb.server import create_user
    53         from cubicweb.server import create_user
    53         create_user(session, unicode(anonlogin), anonpwd, u'guests')
    54         create_user(session, unicode(anonlogin), anonpwd, u'guests')
    54 
    55 
    55 # need this since we already have at least one user in the database (the default admin)
    56 # need this since we already have at least one user in the database (the default admin)