[hg] galaxy 2610: Backed out changeset 19b86ccccf6f (not quite r...
details: http://www.bx.psu.edu/hg/galaxy/rev/3e9b7ec9a305 changeset: 2610:3e9b7ec9a305 user: James Taylor <james@jamestaylor.org> date: Sun Aug 23 12:31:05 2009 -0400 description: Backed out changeset 19b86ccccf6f (not quite ready yet) 5 file(s) affected in this change: lib/galaxy/model/__init__.py lib/galaxy/model/mapping.py lib/galaxy/model/migrate/versions/0014_pages.py lib/galaxy/web/controllers/user.py templates/user/index.mako diffs (220 lines): diff -r 19b86ccccf6f -r 3e9b7ec9a305 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py Sun Aug 23 12:26:46 2009 -0400 +++ b/lib/galaxy/model/__init__.py Sun Aug 23 12:31:05 2009 -0400 @@ -33,7 +33,6 @@ self.external = False self.deleted = False self.purged = False - self.username = None # Relationships self.histories = [] @@ -1119,20 +1118,7 @@ self.country+'<br/>'+ \ 'Phone: '+self.phone -class Page( object ): - def __init__( self ): - self.id = None - self.user = None - self.title = None - self.slug = None - self.latest_revision_id = None - self.revisions = [] -class PageRevision( object ): - def __init__( self ): - self.user = None - self.title = None - self.content = None diff -r 19b86ccccf6f -r 3e9b7ec9a305 lib/galaxy/model/mapping.py --- a/lib/galaxy/model/mapping.py Sun Aug 23 12:26:46 2009 -0400 +++ b/lib/galaxy/model/mapping.py Sun Aug 23 12:31:05 2009 -0400 @@ -42,7 +42,6 @@ Column( "create_time", DateTime, default=now ), Column( "update_time", DateTime, default=now, onupdate=now ), Column( "email", TrimmedString( 255 ), nullable=False ), - Column( "username", TrimmedString( 255 ), index=True, unique=True ), Column( "password", TrimmedString( 40 ), nullable=False ), Column( "external", Boolean, default=False ), Column( "deleted", Boolean, index=True, default=False ), @@ -524,26 +523,6 @@ Column( "sample_state_id", Integer, ForeignKey( "sample_state.id" ), index=True ), Column( "comment", TEXT ) ) -Page.table = Table( "page", metadata, - Column( "id", Integer, primary_key=True ), - Column( "create_time", DateTime, default=now ), - Column( "update_time", DateTime, default=now, onupdate=now ), - Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=False ), - Column( "latest_revision_id", Integer, - ForeignKey( "page_revision.id", use_alter=True, name='page_latest_revision_id_fk' ), index=True ), - Column( "title", TEXT ), - Column( "slug", TEXT, unique=True, index=True ), - ) - -PageRevision.table = Table( "page_revision", metadata, - Column( "id", Integer, primary_key=True ), - Column( "create_time", DateTime, default=now ), - Column( "update_time", DateTime, default=now, onupdate=now ), - Column( "page_id", Integer, ForeignKey( "page.id" ), index=True, nullable=False ), - Column( "title", TEXT ), - Column( "content", TEXT ) - ) - # With the tables defined we can define the mappers and setup the # relationships between the model objects. @@ -926,18 +905,6 @@ assign_mapper( context, MetadataFile, MetadataFile.table, properties=dict( history_dataset=relation( HistoryDatasetAssociation ), library_dataset=relation( LibraryDatasetDatasetAssociation ) ) ) -assign_mapper( context, PageRevision, PageRevision.table ) - -assign_mapper( context, Page, Page.table, - properties=dict( user=relation( User ), - revisions=relation( PageRevision, backref='page', - cascade="all, delete-orphan", - primaryjoin=( Page.table.c.id == PageRevision.table.c.page_id ) ), - latest_revision=relation( PageRevision, post_update=True, - primaryjoin=( Page.table.c.latest_revision_id == PageRevision.table.c.id ), - lazy=False ) - ) ) - def db_next_hid( self ): """ Override __next_hid to generate from the database in a concurrency diff -r 19b86ccccf6f -r 3e9b7ec9a305 lib/galaxy/model/migrate/versions/0014_pages.py --- a/lib/galaxy/model/migrate/versions/0014_pages.py Sun Aug 23 12:26:46 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -from sqlalchemy import * -from migrate import * -from migrate.changeset import * - -import datetime -now = datetime.datetime.utcnow - -import logging -log = logging.getLogger( __name__ ) - -metadata = MetaData( migrate_engine ) - -Page_table = Table( "page", metadata, - Column( "id", Integer, primary_key=True ), - Column( "create_time", DateTime, default=now ), - Column( "update_time", DateTime, default=now, onupdate=now ), - Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=False ), - Column( "latest_revision_id", Integer, - ForeignKey( "page_revision.id", use_alter=True, name='page_latest_revision_id_fk' ), index=True ), - Column( "title", TEXT ), - Column( "slug", TEXT, unique=True, index=True ), - ) - -PageRevision_table = Table( "page_revision", metadata, - Column( "id", Integer, primary_key=True ), - Column( "create_time", DateTime, default=now ), - Column( "update_time", DateTime, default=now, onupdate=now ), - Column( "page_id", Integer, ForeignKey( "page.id" ), index=True, nullable=False ), - Column( "title", TEXT ), - Column( "content", TEXT ) - ) - -def upgrade(): - metadata.reflect() - try: - Page_table.create() - except: - log.debug( "Could not create page table" ) - try: - PageRevision_table.create() - except: - log.debug( "Could not create page_revision table" ) - - # Add 1 column to the user table - User_table = Table( "galaxy_user", metadata, autoload=True ) - col = Column( 'username', String(255), index=True, unique=True, default=False ) - print type( col ), col - col.create( User_table ) - assert col is User_table.c.username - -def downgrade(): - metadata.reflect() - Page_table.drop() - PageRevision_table.drop() - User_table = Table( "galaxy_user", metadata, autoload=True ) - User_table.c.username.drop() \ No newline at end of file diff -r 19b86ccccf6f -r 3e9b7ec9a305 lib/galaxy/web/controllers/user.py --- a/lib/galaxy/web/controllers/user.py Sun Aug 23 12:26:46 2009 -0400 +++ b/lib/galaxy/web/controllers/user.py Sun Aug 23 12:31:05 2009 -0400 @@ -4,7 +4,7 @@ from galaxy.web.base.controller import * from galaxy.model.orm import * from galaxy import util -import logging, os, string, re +import logging, os, string from random import choice log = logging.getLogger( __name__ ) @@ -19,8 +19,6 @@ """ require_login_nocreation_template = require_login_template % "" require_login_creation_template = require_login_template % " If you don't already have an account, <a href='%s'>you may create one</a>." - -VALID_USERNAME_RE = re.compile( "^[a-zA-Z0-9\-\_]+$" ) class User( BaseController ): edit_address_id = None @@ -80,37 +78,6 @@ .add_text( "email", "Email", value=email, error=email_err ) .add_text( "conf_email", "Confirm Email", value='', error=conf_email_err ) .add_password( "password", "Password", value='', error=pass_err ) ) - - @web.expose - def change_username(self, trans, username='', **kwd): - username_err = '' - user = trans.get_user() - if not user: - trans.response.send_redirect( web.url_for( action='login' ) ) - if trans.request.method == "POST": - if len( username ) < 4: - username_err = "Username must be at least 4 characters in length" - elif len( username ) > 255: - username_err = "USername must be at most 255 characters in length" - elif not( VALID_USERNAME_RE.match( username ) ): - username_err = "Username must contain only letters, numbers, '-', and '_'" - elif trans.app.model.User.filter_by( username=username ).first(): - username_err = "This username is not available" - else: - user.username = username - user.flush() - trans.log_event( "User change username" ) - return trans.show_ok_message( "Username been set to: " + user.username ) - else: - username = user.username or '' - return trans.show_form( - web.FormBuilder( web.url_for(), "Change username", submit_text="Submit" ) - .add_text( "username", "Username", value=username, error=username_err, - help="""Your username is an optional identifier that - will be used to generate adresses for information - you share publicly. Usernames must be at least - four characters in length and contain only letters, - numbers, and the '-' and '_' characters""" ) ) @web.expose def login( self, trans, email='', password='' ): diff -r 19b86ccccf6f -r 3e9b7ec9a305 templates/user/index.mako --- a/templates/user/index.mako Sun Aug 23 12:26:46 2009 -0400 +++ b/templates/user/index.mako Sun Aug 23 12:31:05 2009 -0400 @@ -9,7 +9,6 @@ <ul> <li><a href="${h.url_for( action='change_password' )}">${_('Change your password')}</a></li> <li><a href="${h.url_for( action='change_email' )}">${_('Update your email address')}</a></li> - <li><a href="${h.url_for( action='change_username' )}">${_('Change your public username')}</a></li> <li><a href="${h.url_for( action='set_default_permissions' )}">${_('Change default permissions')}</a> for new histories</li> <li><a href="${h.url_for( action='manage_addresses' )}">${_('Manage your addresses')}</a></li> <li><a href="${h.url_for( action='logout' )}">${_('Logout')}</a></li>
participants (1)
-
Greg Von Kuster