[Python-modules-commits] [python-pgspecial] 01/03: Import python-pgspecial_1.7.0.orig.tar.gz

ChangZhuo Chen czchen at moszumanska.debian.org
Sat Dec 24 07:20:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

czchen pushed a commit to branch master
in repository python-pgspecial.

commit e8343835431b7e1c5614ead7625ee3b440182528
Author: ChangZhuo Chen (陳昌倬) <czchen at debian.org>
Date:   Sat Dec 24 14:36:00 2016 +0800

    Import python-pgspecial_1.7.0.orig.tar.gz
---
 PKG-INFO                                            |   2 +-
 pgspecial.egg-info/PKG-INFO                         |   2 +-
 pgspecial.egg-info/SOURCES.txt                      |   6 ++----
 pgspecial.egg-info/pbr.json                         |   1 -
 pgspecial.egg-info/requires.txt                     |   2 +-
 pgspecial/__init__.py                               |   2 +-
 pgspecial/dbcommands.py                             |   2 +-
 pgspecial/iocommands.py                             |  13 +++++++++++--
 pgspecial/main.py                                   |   2 +-
 tests/.cache/v/cache/lastfailed                     |   4 +---
 tests/__pycache__/conftest.cpython-27-PYTEST.pyc    | Bin 0 -> 1630 bytes
 .../__pycache__/test_specials.cpython-27-PYTEST.pyc | Bin 16944 -> 19482 bytes
 tests/__pycache__/test_tm.cpython-27-PYTEST.pyc     | Bin 2301 -> 0 bytes
 tests/conftest.pyc                                  | Bin 1573 -> 0 bytes
 tests/dbutils.py                                    |   2 +-
 tests/dbutils.pyc                                   | Bin 2591 -> 2497 bytes
 tests/test_specials.py                              |  19 ++++++++++---------
 17 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index bce4c1f..7ecc020 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pgspecial
-Version: 1.6.0
+Version: 1.7.0
 Summary: Meta-commands handler for Postgres Database.
 Home-page: http://pgcli.com
 Author: Amjith Ramanujam
diff --git a/pgspecial.egg-info/PKG-INFO b/pgspecial.egg-info/PKG-INFO
index bce4c1f..7ecc020 100644
--- a/pgspecial.egg-info/PKG-INFO
+++ b/pgspecial.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pgspecial
-Version: 1.6.0
+Version: 1.7.0
 Summary: Meta-commands handler for Postgres Database.
 Home-page: http://pgcli.com
 Author: Amjith Ramanujam
diff --git a/pgspecial.egg-info/SOURCES.txt b/pgspecial.egg-info/SOURCES.txt
index b9bccc0..bf0cff6 100644
--- a/pgspecial.egg-info/SOURCES.txt
+++ b/pgspecial.egg-info/SOURCES.txt
@@ -9,17 +9,15 @@ pgspecial/namedqueries.py
 pgspecial.egg-info/PKG-INFO
 pgspecial.egg-info/SOURCES.txt
 pgspecial.egg-info/dependency_links.txt
-pgspecial.egg-info/pbr.json
 pgspecial.egg-info/requires.txt
 pgspecial.egg-info/top_level.txt
 pgspecial/help/__init__.py
 pgspecial/help/commands.py
 tests/conftest.py
-tests/conftest.pyc
 tests/dbutils.py
 tests/dbutils.pyc
 tests/pytest.ini
 tests/test_specials.py
 tests/.cache/v/cache/lastfailed
-tests/__pycache__/test_specials.cpython-27-PYTEST.pyc
-tests/__pycache__/test_tm.cpython-27-PYTEST.pyc
\ No newline at end of file
+tests/__pycache__/conftest.cpython-27-PYTEST.pyc
+tests/__pycache__/test_specials.cpython-27-PYTEST.pyc
\ No newline at end of file
diff --git a/pgspecial.egg-info/pbr.json b/pgspecial.egg-info/pbr.json
deleted file mode 100644
index 56bde1b..0000000
--- a/pgspecial.egg-info/pbr.json
+++ /dev/null
@@ -1 +0,0 @@
-{"is_release": false, "git_version": "77fb297"}
\ No newline at end of file
diff --git a/pgspecial.egg-info/requires.txt b/pgspecial.egg-info/requires.txt
index 6064409..ee0c536 100644
--- a/pgspecial.egg-info/requires.txt
+++ b/pgspecial.egg-info/requires.txt
@@ -1,2 +1,2 @@
 click >= 4.1
-sqlparse >= 0.1.19
+sqlparse >= 0.1.19
\ No newline at end of file
diff --git a/pgspecial/__init__.py b/pgspecial/__init__.py
index c5b2dac..32d911c 100644
--- a/pgspecial/__init__.py
+++ b/pgspecial/__init__.py
@@ -1,5 +1,5 @@
 __all__ = []
-__version__ = '1.6.0'
+__version__ = '1.7.0'
 
 
 def export(defn):
diff --git a/pgspecial/dbcommands.py b/pgspecial/dbcommands.py
index 2f54ac3..4091ac0 100644
--- a/pgspecial/dbcommands.py
+++ b/pgspecial/dbcommands.py
@@ -832,7 +832,7 @@ def describe_one_table_details(cur, schema_name, relation_name, oid, verbose):
         if indisclustered:
             status.append(", clustered")
 
-        if indisvalid:
+        if not indisvalid:
             status.append(", invalid")
 
         if deferrable:
diff --git a/pgspecial/iocommands.py b/pgspecial/iocommands.py
index a04695c..14a869c 100644
--- a/pgspecial/iocommands.py
+++ b/pgspecial/iocommands.py
@@ -4,6 +4,7 @@ import sys
 import logging
 import click
 import io
+import shlex
 import sqlparse
 import psycopg2
 from os.path import expanduser
@@ -144,18 +145,26 @@ def copy(cur, pattern, verbose):
         return [(None, None, None, cur.statusmessage)]
 
 
- at special_command('\\n', '\\n[+] [name]', 'List or execute named queries.')
+ at special_command('\\n', '\\n[+] [name] [param1 param2 ...]', 'List or execute named queries.')
 def execute_named_query(cur, pattern, **_):
     """Returns (title, rows, headers, status)"""
     if pattern == '':
         return list_named_queries(True)
 
+    params = shlex.split(pattern)
+    pattern = params.pop(0)
+
     query = NamedQueries.instance.get(pattern)
     title = '> {}'.format(query)
     if query is None:
         message = "No named query: {}".format(pattern)
         return [(None, None, None, message)]
-    cur.execute(query)
+
+    try:
+        cur.execute(query, params)
+    except (IndexError, TypeError):
+        raise Exception("Bad arguments")
+
     if cur.description:
         headers = [x[0] for x in cur.description]
         return [(title, cur, headers, cur.statusmessage)]
diff --git a/pgspecial/main.py b/pgspecial/main.py
index 8f6dd54..202f5d0 100644
--- a/pgspecial/main.py
+++ b/pgspecial/main.py
@@ -53,7 +53,7 @@ class PGSpecial(object):
                       'Toggle expanded output.', arg_type=PARSED_QUERY)
 
         self.register(self.call_pset, '\\pset', '\\pset [key] [value]',
-                      'A limited version of tradtional \pset', arg_type=PARSED_QUERY)
+                      'A limited version of traditional \pset', arg_type=PARSED_QUERY)
 
         self.register(self.show_command_help, '\\h', '\\h',
                       'Show SQL syntax and help.', arg_type=PARSED_QUERY)
diff --git a/tests/.cache/v/cache/lastfailed b/tests/.cache/v/cache/lastfailed
index 0ba23c8..9e26dfe 100644
--- a/tests/.cache/v/cache/lastfailed
+++ b/tests/.cache/v/cache/lastfailed
@@ -1,3 +1 @@
-{
-  "test_specials.py::test_create_file": true
-}
\ No newline at end of file
+{}
\ No newline at end of file
diff --git a/tests/__pycache__/conftest.cpython-27-PYTEST.pyc b/tests/__pycache__/conftest.cpython-27-PYTEST.pyc
new file mode 100644
index 0000000..82df8bd
Binary files /dev/null and b/tests/__pycache__/conftest.cpython-27-PYTEST.pyc differ
diff --git a/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc b/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc
index 7b70013..16f8c12 100644
Binary files a/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc and b/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc differ
diff --git a/tests/__pycache__/test_tm.cpython-27-PYTEST.pyc b/tests/__pycache__/test_tm.cpython-27-PYTEST.pyc
deleted file mode 100644
index 59882be..0000000
Binary files a/tests/__pycache__/test_tm.cpython-27-PYTEST.pyc and /dev/null differ
diff --git a/tests/conftest.pyc b/tests/conftest.pyc
deleted file mode 100644
index 6dfaf25..0000000
Binary files a/tests/conftest.pyc and /dev/null differ
diff --git a/tests/dbutils.py b/tests/dbutils.py
index ed16b61..4d13527 100644
--- a/tests/dbutils.py
+++ b/tests/dbutils.py
@@ -26,7 +26,7 @@ except:
 dbtest = pytest.mark.skipif(
     not CAN_CONNECT_TO_DB,
     reason="Need a postgres instance at localhost accessible by user "
-           "'postgres'")
+           "'%s'" % POSTGRES_USER)
 
 
 def create_db(dbname):
diff --git a/tests/dbutils.pyc b/tests/dbutils.pyc
index 320ad9b..a464794 100644
Binary files a/tests/dbutils.pyc and b/tests/dbutils.pyc differ
diff --git a/tests/test_specials.py b/tests/test_specials.py
index aab0f54..5499e3f 100644
--- a/tests/test_specials.py
+++ b/tests/test_specials.py
@@ -1,7 +1,7 @@
   #!/usr/bin/python
   # -*- coding: utf-8 -*-
 
-from dbutils import dbtest
+from dbutils import dbtest, POSTGRES_USER
 import itertools
 from codecs import open
 
@@ -10,12 +10,13 @@ from codecs import open
 def test_slash_d(executor):
     results = executor('\d')
     title = None
-    rows = [('public', 'tbl1', 'table', 'postgres'),
-            ('public', 'tbl2', 'table', 'postgres'),
-            ('public', 'vw1', 'view', 'postgres')]
+    rows = [('public', 'tbl1', 'table', POSTGRES_USER),
+            ('public', 'tbl2', 'table', POSTGRES_USER),
+            ('public', 'vw1', 'view', POSTGRES_USER)]
     headers = ['Schema', 'Name', 'Type', 'Owner']
     status = 'SELECT 3'
     expected = [title, rows, headers, status]
+
     assert results == expected
 
 
@@ -37,9 +38,9 @@ def test_slash_dn(executor):
     """List all schemas."""
     results = executor('\dn')
     title = None
-    rows = [('public', 'postgres'),
-            ('schema1', 'postgres'),
-            ('schema2', 'postgres')]
+    rows = [('public', POSTGRES_USER),
+            ('schema1', POSTGRES_USER),
+            ('schema2', POSTGRES_USER)]
     headers = ['Name', 'Owner']
     status = 'SELECT 3'
     expected = [title, rows, headers, status]
@@ -51,8 +52,8 @@ def test_slash_dt(executor):
     """List all tables in public schema."""
     results = executor('\dt')
     title = None
-    rows = [('public', 'tbl1', 'table', 'postgres'),
-            ('public', 'tbl2', 'table', 'postgres')]
+    rows = [('public', 'tbl1', 'table', POSTGRES_USER),
+            ('public', 'tbl2', 'table', POSTGRES_USER)]
     headers = ['Schema', 'Name', 'Type', 'Owner']
     status = 'SELECT 2'
     expected = [title, rows, headers, status]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pgspecial.git



More information about the Python-modules-commits mailing list