equal
deleted
inserted
replaced
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
44 |
44 |
45 _MARKER = object() |
45 _MARKER = object() |
46 |
46 |
47 # initialize random seed from current time |
47 # initialize random seed from current time |
48 random.seed() |
48 random.seed() |
|
49 |
|
50 def admincnx(appid): |
|
51 from cubicweb.cwconfig import CubicWebConfiguration |
|
52 from cubicweb.server.repository import Repository |
|
53 from cubicweb.server.utils import TasksManager |
|
54 config = CubicWebConfiguration.config_for(appid) |
|
55 |
|
56 login = config.default_admin_config['login'] |
|
57 password = config.default_admin_config['password'] |
|
58 |
|
59 repo = Repository(config, TasksManager()) |
|
60 session = repo.new_session(login, password=password) |
|
61 return session.new_cnx() |
|
62 |
49 |
63 |
50 def make_uid(key=None): |
64 def make_uid(key=None): |
51 """Return a unique identifier string. |
65 """Return a unique identifier string. |
52 |
66 |
53 if specified, `key` is used to prefix the generated uid so it can be used |
67 if specified, `key` is used to prefix the generated uid so it can be used |