diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-09-10 13:16:22 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-09-10 13:17:07 -0400 |
commit | 6acf4ee60e3c07aea5bbd9e613335f0de1240d73 (patch) | |
tree | ff897644ee801d5faec2aba93f29a03866591083 /mediagoblin/db | |
parent | 25625107b6c7805b474ad7da976171991b259e58 (diff) | |
download | mediagoblin-6acf4ee60e3c07aea5bbd9e613335f0de1240d73.tar.lz mediagoblin-6acf4ee60e3c07aea5bbd9e613335f0de1240d73.tar.xz mediagoblin-6acf4ee60e3c07aea5bbd9e613335f0de1240d73.zip |
This should be my final code update before I am ready for review! Basically, in
this update I finished the search/sort function on the Reports Panel. I also
finished the Terms of Service and made the decision to remove the meta portion
of the site I had planned to create. I decided that the features involved were
just unnecessary at this point. I also dropped the User status column and added
a migration to establish default privileges (and create the privilege foundat-
-ions. I fixed a few small errors that were left over as well, in the implemen-
tation and in the tests. Next, I just need to await code review and work on the
documentation for these new features. I also need to supervise a new merge to
master.
===============================================================================
Dropped the vestigial 'status' column
===============================================================================
--\ mediagoblin/db/migrations.py
--\ mediagoblin/db/models.py
--| Also added in comments describing the current situation with the `is_admin`
| and `email_verified` columns, where they are 100% vestigial but cannot be
| dropped.
===============================================================================
Wrote necessary migrations to set up Privilege
foundations and give users the necessary privileges on an older
implementation of mediagoblin that is migrating into this update
===============================================================================
--\ mediagoblin/db/migrations.py
===============================================================================
Deleted the meta pages
===============================================================================
--\ Deleted mediagoblin/meta/__init__.py
--\ Deleted mediagoblin/meta/routing.py
--\ Deleted mediagoblin/meta/views.py
--\ Deleted mediagoblin/templates/mediagoblin/meta/code_of_conduct.html
--\ Deleted mediagoblin/templates/mediagoblin/meta/reports_details.html
--\ Deleted mediagoblin/templates/mediagoblin/meta/reports_panel.html
----------------------------------------------------------------
Moved the terms of service to /terms_of_service
----------------------------------------------------------------
--\ Moved mediagoblin/templates/mediagoblin/meta/terms_of_service.html
-> mediagoblin/templates/mediagoblin/terms_of_service.html
--| I decided that terms of service were really the only necessary part of my
| planned "meta" pages, so I moved it instead to its own singular page
--\ mediagoblin/routing.py
--\ mediagoblin/static/css/base.css
--\ mediagoblin/templates/mediagoblin/base.html
--\ mediagoblin/views.py
===============================================================================
Simplified & Finished the Reports Panel Searching
===============================================================================
--\ mediagoblin/moderation/forms.py
--\ mediagoblin/moderation/tools.py
--\ mediagoblin/moderation/views.py
--\ mediagoblin/templates/mediagoblin/moderation/report_panel.html
--\ mediagoblin/templates/mediagoblin/moderation/user.html
===============================================================================
Fixed Small Errors
===============================================================================
--\ mediagoblin/templates/mediagoblin/user_pages/user.html
--\ mediagoblin/tests/test_moderation.py
--\ mediagoblin/tests/tools.py
===============================================================================
Diffstat (limited to 'mediagoblin/db')
-rw-r--r-- | mediagoblin/db/migrations.py | 11 | ||||
-rw-r--r-- | mediagoblin/db/models.py | 5 |
2 files changed, 14 insertions, 2 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 1c0a9291..984ef060 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -542,7 +542,7 @@ def create_moderation_tables(db): @RegisterMigration(16, MIGRATIONS) def update_user_privilege_columns(db): - metadata = MetaData(bind=db.bind) + # first, create the privileges which would be created by foundations default_privileges = Privilege.query.filter( Privilege.privilege_name !=u'admin').filter( Privilege.privilege_name !=u'moderator').filter( @@ -551,6 +551,7 @@ def update_user_privilege_columns(db): Privilege.privilege_name ==u'admin').first() active_privilege = Privilege.query.filter( Privilege.privilege_name ==u'active').first() + # then, assign them to the appropriate users for inactive_user in User.query.filter( User.status!=u'active').filter( User.is_admin==False).all(): @@ -569,3 +570,11 @@ def update_user_privilege_columns(db): admin_user.all_privileges = default_privileges + [ admin_privilege, active_privilege] admin_user.save() + + # and then drop the now vestigial status column + metadata = MetaData(bind=db.bind) + user_table = inspect_table(metadata, 'core__users') + status = user_table.columns['status'] + status.drop() + db.commit() + diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 5b77a85d..ce1de36b 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -63,13 +63,16 @@ class User(Base, UserMixin): # point. email = Column(Unicode, nullable=False) pw_hash = Column(Unicode) +#--column email_verified is VESTIGIAL with privileges and should not be used--- +#--should be dropped ASAP though a bug in sqlite3 prevents this atm------------ email_verified = Column(Boolean, default=False) created = Column(DateTime, nullable=False, default=datetime.datetime.now) - status = Column(Unicode, default=u"needs_email_verification", nullable=False) # Intented to be nullable=False, but migrations would not work for it # set to nullable=True implicitly. wants_comment_notification = Column(Boolean, default=True) license_preference = Column(Unicode) +#--column admin is VESTIGIAL with privileges and should not be used------------ +#--should be dropped ASAP though a bug in sqlite3 prevents this atm------------ is_admin = Column(Boolean, default=False, nullable=False) url = Column(Unicode) bio = Column(UnicodeText) # ?? |