Build a list of treeview nodes from the child nodes.
(self, **kwargs)
| 415 | return nodes |
| 416 | |
| 417 | def children(self, **kwargs): |
| 418 | """Build a list of treeview nodes from the child nodes.""" |
| 419 | |
| 420 | if 'sid' not in kwargs: |
| 421 | return precondition_required( |
| 422 | gettext('Required properties are missing.') |
| 423 | ) |
| 424 | |
| 425 | from pgadmin.utils.driver import get_driver |
| 426 | manager = get_driver(PG_DEFAULT_DRIVER).connection_manager( |
| 427 | sid=kwargs['sid'] |
| 428 | ) |
| 429 | |
| 430 | did = None |
| 431 | if 'did' in kwargs: |
| 432 | did = kwargs['did'] |
| 433 | |
| 434 | try: |
| 435 | conn = manager.connection(did=did) |
| 436 | # Use ping() instead of connected() to detect stale / |
| 437 | # half-open TCP connections that were silently dropped while |
| 438 | # pgAdmin was idle. connected() only checks local state and |
| 439 | # would miss these, causing the subsequent SQL queries to |
| 440 | # hang indefinitely. |
| 441 | if not conn.ping(): |
| 442 | status, msg = conn.connect() |
| 443 | if not status: |
| 444 | return service_unavailable( |
| 445 | msg, info="CONNECTION_LOST" |
| 446 | ) |
| 447 | except (ConnectionLost, SSHTunnelConnectionLost, CryptKeyMissing): |
| 448 | raise |
| 449 | except Exception: |
| 450 | return precondition_required( |
| 451 | gettext( |
| 452 | "Connection to the server has been lost." |
| 453 | ) |
| 454 | ) |
| 455 | |
| 456 | # Return sorted nodes based on label |
| 457 | return make_json_response( |
| 458 | data=sorted( |
| 459 | self.get_children_nodes(manager, **kwargs), |
| 460 | key=lambda c: c['label'] |
| 461 | ) |
| 462 | ) |
| 463 | |
| 464 | def get_dependencies(self, conn, object_id, where=None, |
| 465 | show_system_objects=None, is_schema_diff=False): |
nothing calls this directly
no test coverage detected