Show More
@@ -54,6 +54,11 b' class Command(BasePasterCommand):' | |||||
54 | parser = BasePasterCommand.standard_parser(verbose=True) |
|
54 | parser = BasePasterCommand.standard_parser(verbose=True) | |
55 | summary = "Interactive shell" |
|
55 | summary = "Interactive shell" | |
56 |
|
56 | |||
|
57 | def import_all_from_module(self, module_name): | |||
|
58 | import importlib | |||
|
59 | module = importlib.import_module(module_name) | |||
|
60 | globals().update({k: v for k, v in module.__dict__.items() if not k.startswith('_')}) | |||
|
61 | ||||
57 | def command(self): |
|
62 | def command(self): | |
58 | #get SqlAlchemy session |
|
63 | # get SqlAlchemy session | |
59 | self._init_session() |
|
64 | self._init_session() | |
@@ -64,7 +69,7 b' class Command(BasePasterCommand):' | |||||
64 | import time |
|
69 | import time | |
65 | import shutil |
|
70 | import shutil | |
66 | import datetime |
|
71 | import datetime | |
67 |
|
|
72 | self.import_all_from_module('rhodecode.model.db') | |
68 |
|
73 | |||
69 | try: |
|
74 | try: | |
70 | from IPython import embed |
|
75 | from IPython import embed |
@@ -41,6 +41,12 b' or reset some user/system settings.' | |||||
41 | """ |
|
41 | """ | |
42 |
|
42 | |||
43 |
|
43 | |||
|
44 | def import_all_from_module(module_name): | |||
|
45 | import importlib | |||
|
46 | module = importlib.import_module(module_name) | |||
|
47 | globals().update({k: v for k, v in module.__dict__.items() if not k.startswith('_')}) | |||
|
48 | ||||
|
49 | ||||
44 | def ipython_shell_runner(env, help): |
|
50 | def ipython_shell_runner(env, help): | |
45 |
|
51 | |||
46 | # imports, used in ipython shell |
|
52 | # imports, used in ipython shell | |
@@ -50,7 +56,7 b' def ipython_shell_runner(env, help):' | |||||
50 | import shutil |
|
56 | import shutil | |
51 | import datetime |
|
57 | import datetime | |
52 | from rhodecode.model import user, user_group, repo, repo_group |
|
58 | from rhodecode.model import user, user_group, repo, repo_group | |
53 |
|
|
59 | import_all_from_module('rhodecode.model.db') | |
54 |
|
60 | |||
55 | try: |
|
61 | try: | |
56 | import IPython |
|
62 | import IPython |
General Comments 0
You need to be logged in to leave comments.
Login now