superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: Upgrade flask-appbuilder to latest. (#6030)
Date Mon, 08 Oct 2018 16:40:58 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 9dcf8e1  Upgrade flask-appbuilder to latest. (#6030)
9dcf8e1 is described below

commit 9dcf8e101a6740d15b126c0a17c7a16ca5ae7225
Author: Joshua Carp <jm.carp@gmail.com>
AuthorDate: Mon Oct 8 12:40:52 2018 -0400

    Upgrade flask-appbuilder to latest. (#6030)
    
    * Upgrade flask-appbuilder to latest.
    
    * Skip constraint deletes if not exist.
    
    * Document breaking change in flask-login.
---
 UPDATING.md                                         |  5 +++++
 requirements.txt                                    |  2 +-
 setup.py                                            |  2 +-
 ...19ee0e3_fix_wrong_constraint_on_table_columns.py |  5 +++--
 .../versions/3b626e2a6783_sync_db_with_models.py    | 21 ++++++---------------
 superset/security.py                                |  2 +-
 superset/templates/appbuilder/navbar_right.html     |  2 +-
 superset/views/base.py                              |  4 ++--
 superset/views/utils.py                             |  2 +-
 9 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/UPDATING.md b/UPDATING.md
index 48fa027..326a57d 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -16,6 +16,11 @@ assists people when migrating to a new version.
 
 * Superset 0.28 deprecates the `median` cluster label aggregator for mapbox visualizations.
This particular aggregation is not supported on mapbox visualizations going forward.
 
+* Superset 0.28 upgrades `flask-login` to `>=0.3`, which includes a
+    backwards-incompatible change: `g.user.is_authenticated`,
+    `g.user.is_anonymous`, and `g.user.is_active` are now properties
+    instead of properties.
+
 ## Superset 0.27.0
 * Superset 0.27 start to use nested layout for dashboard builder, which is not
 backward-compatible with earlier dashboard grid data. We provide migration script
diff --git a/requirements.txt b/requirements.txt
index f1a3cd7..9fa2bff 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,7 +6,7 @@ click==6.7
 colorama==0.3.9
 cryptography==1.9
 flask==0.12.2
-flask-appbuilder==1.10.0
+flask-appbuilder==1.12.0
 flask-caching==1.4.0
 flask-compress==1.4.0
 flask-migrate==2.1.1
diff --git a/setup.py b/setup.py
index 6cbe7a6..5816a05 100644
--- a/setup.py
+++ b/setup.py
@@ -67,7 +67,7 @@ setup(
         'contextlib2',
         'cryptography',
         'flask<1.0.0',
-        'flask-appbuilder==1.10.0',  # known db migration with 1.11+
+        'flask-appbuilder>=1.12.0',
         'flask-caching',
         'flask-compress',
         'flask-migrate',
diff --git a/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
b/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
index f5d940c..a7682ef 100644
--- a/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
+++ b/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
@@ -33,10 +33,11 @@ def find_constraint_name(upgrade=True):
 
 def upgrade():
     try:
-        constraint = find_constraint_name() or 'fk_columns_column_name_datasources'
+        constraint = find_constraint_name()
         with op.batch_alter_table("columns",
                 naming_convention=naming_convention) as batch_op:
-            batch_op.drop_constraint(constraint, type_="foreignkey")
+            if constraint:
+                batch_op.drop_constraint(constraint, type_="foreignkey")
             batch_op.create_foreign_key(
                 'fk_columns_datasource_name_datasources',
                 'datasources',
diff --git a/superset/migrations/versions/3b626e2a6783_sync_db_with_models.py b/superset/migrations/versions/3b626e2a6783_sync_db_with_models.py
index f1bf949..8e21114 100644
--- a/superset/migrations/versions/3b626e2a6783_sync_db_with_models.py
+++ b/superset/migrations/versions/3b626e2a6783_sync_db_with_models.py
@@ -27,14 +27,16 @@ def upgrade():
     try:
         slices_ibfk_1 = generic_find_constraint_name(
             table='slices', columns={'druid_datasource_id'},
-            referenced='datasources', db=db) or 'slices_ibfk_1'
+            referenced='datasources', db=db)
         slices_ibfk_2 = generic_find_constraint_name(
             table='slices', columns={'table_id'},
-            referenced='tables', db=db) or 'slices_ibfk_2'
+            referenced='tables', db=db)
 
         with op.batch_alter_table("slices") as batch_op:
-            batch_op.drop_constraint(slices_ibfk_1, type_="foreignkey")
-            batch_op.drop_constraint(slices_ibfk_2, type_="foreignkey")
+            if slices_ibfk_1:
+                batch_op.drop_constraint(slices_ibfk_1, type_="foreignkey")
+            if slices_ibfk_2:
+                batch_op.drop_constraint(slices_ibfk_2, type_="foreignkey")
             batch_op.drop_column('druid_datasource_id')
             batch_op.drop_column('table_id')
     except Exception as e:
@@ -59,17 +61,6 @@ def upgrade():
     except Exception as e:
         logging.warning(str(e))
 
-    try:
-        # wasn't created for some databases in the migration b4456560d4f3
-        if not table_has_constraint('tables', '_customer_location_uc', db):
-            with op.batch_alter_table('tables') as batch_op:
-                batch_op.create_unique_constraint(
-                    '_customer_location_uc',
-                    ['database_id', 'schema', 'table_name'])
-                batch_op.drop_index('table_name')
-    except Exception as e:
-        logging.warning(str(e))
-
 
 def downgrade():
     try:
diff --git a/superset/security.py b/superset/security.py
index be8805b..3f2358e 100644
--- a/superset/security.py
+++ b/superset/security.py
@@ -89,7 +89,7 @@ class SupersetSecurityManager(SecurityManager):
         """Protecting from has_access failing from missing perms/view"""
         if not user:
             user = g.user
-        if user.is_anonymous():
+        if user.is_anonymous:
             return self.is_item_public(permission_name, view_name)
         return self._has_view_access(user, permission_name, view_name)
 
diff --git a/superset/templates/appbuilder/navbar_right.html b/superset/templates/appbuilder/navbar_right.html
index 9d6c251..1d6fb69 100644
--- a/superset/templates/appbuilder/navbar_right.html
+++ b/superset/templates/appbuilder/navbar_right.html
@@ -27,7 +27,7 @@
 
 
 
-{% if not current_user.is_anonymous() %}
+{% if not current_user.is_anonymous %}
     <li class="dropdown">
       <a
         class="dropdown-toggle"
diff --git a/superset/views/base.py b/superset/views/base.py
index 42de225..6db3358 100644
--- a/superset/views/base.py
+++ b/superset/views/base.py
@@ -85,7 +85,7 @@ def get_datasource_exist_error_msg(full_name):
 
 
 def get_user_roles():
-    if g.user.is_anonymous():
+    if g.user.is_anonymous:
         public_role = conf.get('AUTH_ROLE_PUBLIC')
         return [security_manager.find_role(public_role)] if public_role else []
     return g.user.roles
@@ -289,7 +289,7 @@ def check_ownership(obj, raise_if_false=True):
     security_exception = SupersetSecurityException(
         "You don't have the rights to alter [{}]".format(obj))
 
-    if g.user.is_anonymous():
+    if g.user.is_anonymous:
         if raise_if_false:
             raise security_exception
         return False
diff --git a/superset/views/utils.py b/superset/views/utils.py
index b02abea..1d7d4d8 100644
--- a/superset/views/utils.py
+++ b/superset/views/utils.py
@@ -30,7 +30,7 @@ def bootstrap_user_data(username=None, include_perms=False):
         'firstName': user.first_name,
         'lastName': user.last_name,
         'userId': user.id,
-        'isActive': user.is_active(),
+        'isActive': user.is_active,
         'createdOn': user.created_on.isoformat(),
         'email': user.email,
     }


Mime
View raw message