You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sn...@apache.org on 2015/12/01 10:41:51 UTC

[1/2] cassandra git commit: fix: show CQL help in cqlsh in web browser

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 4378b58bb -> 1cbd82782


fix: show CQL help in cqlsh in web browser

patch by Robert Stupp; reviewed by Paulo Motta for CASSANDRA-7225


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8738087e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8738087e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8738087e

Branch: refs/heads/cassandra-3.0
Commit: 8738087edd79f2bd2007df0829087f7637aa8aa3
Parents: a013f3e
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue Dec 1 10:39:05 2015 +0100
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue Dec 1 10:39:05 2015 +0100

----------------------------------------------------------------------
 bin/cqlsh.py                 | 11 ++++++++---
 pylib/cqlshlib/helptopics.py | 22 ++++++++++++++++++++--
 2 files changed, 28 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8738087e/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index e7dc121..027a45e 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -71,6 +71,7 @@ except ImportError:
 CQL_LIB_PREFIX = 'cassandra-driver-internal-only-'
 
 CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
+CASSANDRA_CQL_HTML_FALLBACK = 'https://cassandra.apache.org/doc/cql3/CQL-2.2.html'
 
 if os.path.exists(CASSANDRA_PATH + '/doc/cql3/CQL.html'):
     # default location of local CQL.html
@@ -80,7 +81,7 @@ elif os.path.exists('/usr/share/doc/cassandra/CQL.html'):
     CASSANDRA_CQL_HTML = 'file:///usr/share/doc/cassandra/CQL.html'
 else:
     # fallback to online version
-    CASSANDRA_CQL_HTML = 'https://cassandra.apache.org/doc/cql3/CQL-2.2.html'
+    CASSANDRA_CQL_HTML = CASSANDRA_CQL_HTML_FALLBACK
 
 # On Linux, the Python webbrowser module uses the 'xdg-open' executable
 # to open a file/URL. But that only works, if the current session has been
@@ -92,7 +93,9 @@ else:
 # >>> webbrowser._tryorder
 # >>> webbrowser._browser
 #
-if webbrowser._tryorder[0] == 'xdg-open' and os.environ.get('XDG_DATA_DIRS', '') == '':
+if len(webbrowser._tryorder) == 0:
+    CASSANDRA_CQL_HTML = CASSANDRA_CQL_HTML_FALLBACK
+elif webbrowser._tryorder[0] == 'xdg-open' and os.environ.get('XDG_DATA_DIRS', '') == '':
     # only on Linux (some OS with xdg-open)
     webbrowser._tryorder.remove('xdg-open')
     webbrowser._tryorder.append('xdg-open')
@@ -2213,7 +2216,9 @@ class Shell(cmd.Cmd):
                 urlpart = cqldocs.get_help_topic(t)
                 if urlpart is not None:
                     url = "%s#%s" % (CASSANDRA_CQL_HTML, urlpart)
-                    if self.browser is not None:
+                    if len(webbrowser._tryorder) == 0:
+                        self.printerr("*** No browser to display CQL help. URL for help topic %s : %s" % (t, url))
+                    elif self.browser is not None:
                         webbrowser.get(self.browser).open_new_tab(url)
                     else:
                         webbrowser.open_new_tab(url)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8738087e/pylib/cqlshlib/helptopics.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/helptopics.py b/pylib/cqlshlib/helptopics.py
index c2eebe3..279063b 100644
--- a/pylib/cqlshlib/helptopics.py
+++ b/pylib/cqlshlib/helptopics.py
@@ -14,8 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from .cql3handling import simple_cql_types
-
 
 class CQL3HelpTopics(object):
 
@@ -73,8 +71,10 @@ class CQL3HelpTopics(object):
 
     def help_json(self):
         return 'json'
+
     def help_select_json(self):
         return 'selectJson'
+
     def help_insert_json(self):
         return 'insertJson'
 
@@ -85,21 +85,27 @@ class CQL3HelpTopics(object):
 
     def help_create_keyspace(self):
         return 'createKeyspaceStmt'
+
     def help_alter_keyspace(self):
         return 'alterKeyspaceStmt'
+
     def help_drop_keyspace(self):
         return 'dropKeyspaceStmt'
 
     def help_create_table(self):
         return 'createTableStmt'
     help_create_columnfamily = help_create_table
+
     def help_alter_table(self):
         return 'alterTableStmt'
+
     def help_drop_table(self):
         return 'dropTableStmt'
     help_drop_columnfamily = help_drop_table
+
     def help_create_index(self):
         return 'createIndexStmt'
+
     def help_drop_index(self):
         return 'dropIndexStmt'
 
@@ -108,27 +114,34 @@ class CQL3HelpTopics(object):
 
     def help_create_type(self):
         return 'createTypeStmt'
+
     def help_alter_type(self):
         return 'alterTypeStmt'
+
     def help_drop_type(self):
         return 'dropTypeStmt'
 
     def help_create_function(self):
         return 'createFunctionStmt'
+
     def help_drop_function(self):
         return 'dropFunctionStmt'
+
     def help_functions(self):
         return 'functions'
 
     def help_create_aggregate(self):
         return 'createAggregateStmt'
+
     def help_drop_aggregate(self):
         return 'dropAggregateStmt'
+
     def help_aggregates(self):
         return 'aggregates'
 
     def help_create_trigger(self):
         return 'createTriggerStmt'
+
     def help_drop_trigger(self):
         return 'dropTriggerStmt'
 
@@ -137,19 +150,24 @@ class CQL3HelpTopics(object):
 
     def help_create_user(self):
         return 'createUserStmt'
+
     def help_alter_user(self):
         return 'alterUserStmt'
+
     def help_drop_user(self):
         return 'dropUserStmt'
+
     def help_list_users(self):
         return 'listUsersStmt'
 
     def help_permissions(self):
         return 'permissions'
+
     def help_list_permissions(self):
         return 'listPermissionsStmt'
 
     def help_grant(self):
         return 'grantRoleStmt'
+
     def help_revoke(self):
         return 'revokeRoleStmt'


[2/2] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by sn...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1cbd8278
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1cbd8278
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1cbd8278

Branch: refs/heads/cassandra-3.0
Commit: 1cbd82782e14f097af600f2334ee4031fc7e2706
Parents: 4378b58 8738087
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue Dec 1 10:40:07 2015 +0100
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue Dec 1 10:40:07 2015 +0100

----------------------------------------------------------------------
 bin/cqlsh.py                 | 11 ++++++++---
 pylib/cqlshlib/helptopics.py | 25 ++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1cbd8278/bin/cqlsh.py
----------------------------------------------------------------------
diff --cc bin/cqlsh.py
index 6b87d9f,027a45e..7435f00
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@@ -71,8 -71,8 +71,9 @@@ except ImportError
  CQL_LIB_PREFIX = 'cassandra-driver-internal-only-'
  
  CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
 -CASSANDRA_CQL_HTML_FALLBACK = 'https://cassandra.apache.org/doc/cql3/CQL-2.2.html'
++CASSANDRA_CQL_HTML_FALLBACK = 'https://cassandra.apache.org/doc/cql3/CQL-3.0.html'
  
 +# default location of local CQL.html
  if os.path.exists(CASSANDRA_PATH + '/doc/cql3/CQL.html'):
      # default location of local CQL.html
      CASSANDRA_CQL_HTML = 'file://' + CASSANDRA_PATH + '/doc/cql3/CQL.html'

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1cbd8278/pylib/cqlshlib/helptopics.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/helptopics.py
index 347b17d,279063b..46cd156
--- a/pylib/cqlshlib/helptopics.py
+++ b/pylib/cqlshlib/helptopics.py
@@@ -14,9 -14,9 +14,8 @@@
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
- from .cql3handling import simple_cql_types
  
  class CQL3HelpTopics(object):
 -
      def get_help_topics(self):
          return [t[5:] for t in dir(self) if t.startswith('help_')]
  
@@@ -130,13 -145,6 +144,15 @@@
      def help_drop_trigger(self):
          return 'dropTriggerStmt'
  
 +    def help_create_materialized_view(self):
 +        return 'createMVStmt'
++
 +    def help_alter_materialized_view(self):
 +        return 'alterMVStmt'
++
 +    def help_drop_materialized_view(self):
 +        return 'dropMVStmt'
 +
      def help_keywords(self):
          return 'appendixA'
  
@@@ -149,15 -160,9 +168,18 @@@
      def help_list_users(self):
          return 'listUsersStmt'
  
 +    def help_create_role(self):
 +        return 'createRoleStmt'
++
 +    def help_drop_role(self):
 +        return 'dropRoleStmt'
++
 +    def help_list_roles(self):
 +        return 'listRolesStmt'
 +
      def help_permissions(self):
          return 'permissions'
+ 
      def help_list_permissions(self):
          return 'listPermissionsStmt'