In [ ]:
from lektor.project import Project
project = Project.discover()
env = project.make_env()
pad = env.new_pad()

In [ ]:
from lektor.db import Query
q = Query('/articles', pad).order_by('-mtime')
for e in q:
    print(e)

In [12]:
root_record = pad.root
print(root_record)
for c in root_record.children:
    print(c)


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-12-7b81c7c815e6> in <module>
      1 root_record = pad.root
----> 2 print(root_record)
      3 for c in root_record.children:
      4     print(c)

<ipython-input-12-7b81c7c815e6> in <module>
      1 root_record = pad.root
----> 2 print(root_record)
      3 for c in root_record.children:
      4     print(c)

~/opt/pycharm-2019.2.1/helpers/pydev/_pydevd_bundle/pydevd_frame.py in trace_dispatch(self, frame, event, arg)
    675                 # if thread has a suspend flag, we suspend with a busy wait
    676                 if info.pydev_state == STATE_SUSPEND:
--> 677                     self.do_wait_suspend(thread, frame, event, arg)
    678                     # No need to reset frame.f_trace to keep the same trace function.
    679                     return self.trace_dispatch

~/opt/pycharm-2019.2.1/helpers/pydev/_pydevd_bundle/pydevd_frame.py in do_wait_suspend(self, *args, **kwargs)
    132 
    133     def do_wait_suspend(self, *args, **kwargs):
--> 134         self._args[0].do_wait_suspend(*args, **kwargs)
    135 
    136     # IFDEF CYTHON

~/opt/pycharm-2019.2.1/helpers/pydev/pydevd.py in do_wait_suspend(self, thread, frame, event, arg, send_suspend_message, is_unhandled_exception)
   1086 
   1087         with self._threads_suspended_single_notification.notify_thread_suspended(thread_id, stop_reason):
-> 1088             self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread)
   1089 
   1090     def _do_wait_suspend(self, thread, frame, event, arg, suspend_type, from_this_thread):

~/opt/pycharm-2019.2.1/helpers/pydev/pydevd.py in _do_wait_suspend(self, thread, frame, event, arg, suspend_type, from_this_thread)
   1101 
   1102                 self.process_internal_commands()
-> 1103                 time.sleep(0.01)
   1104 
   1105         self.cancel_async_evaluation(get_current_thread_id(thread), str(id(frame)))

KeyboardInterrupt: