1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/cb18eb985ab3/
changeset: cb18eb985ab3
user: greg
date: 2011-06-30 21:09:08
summary: Increment the repository.times_downloaded column in the Galaxy tool shed database when the repository is cloned from the command line.
affected #: 1 file (1.6 KB)
--- a/lib/galaxy/webapps/community/framework/middleware/hg.py Thu Jun 30 14:07:55 2011 -0400
+++ b/lib/galaxy/webapps/community/framework/middleware/hg.py Thu Jun 30 15:09:08 2011 -0400
@@ -23,14 +23,41 @@
self.username = None
self.action = None
def __call__( self, environ, start_response ):
- # Handle authentication for hg push commands
cmd = self.__get_hg_command( **environ )
+ if cmd == 'changegroup':
+ # This is an hg clone from the command line. When doing this, the following 5 commands, in order,
+ # will be retrieved from environ:
+ # between -> heads -> changegroup -> capabilities -> listkeys
+ #
+ # Increment the value of the times_downloaded column in the repository table for the cloned repository.
+ if 'PATH_INFO' in environ:
+ path_info = environ[ 'PATH_INFO' ].lstrip( '/' )
+ # An example of path_info is: '/repos/test/column1'
+ path_info_components = path_info.split( '/' )
+ username = path_info_components[1]
+ name = path_info_components[2]
+ # Instantiate a database connection
+ db_url = self.config[ 'database_connection' ]
+ engine = create_engine( db_url )
+ connection = engine.connect()
+ result_set = connection.execute( "select id from galaxy_user where username = '%s'" % username.lower() )
+ for row in result_set:
+ # Should only be 1 row...
+ user_id = row[ 'id' ]
+ result_set = connection.execute( "select times_downloaded from repository where user_id = %d and name = '%s'" % ( user_id, name.lower() ) )
+ for row in result_set:
+ # Should only be 1 row...
+ times_downloaded = row[ 'times_downloaded' ]
+ times_downloaded += 1
+ connection.execute( "update repository set times_downloaded = %d where user_id = %d and name = '%s'" % ( times_downloaded, user_id, name.lower() ) )
+ connection.close()
if cmd == 'unbundle':
+ # This is an hg push from the command line. When doing this, the following 7 commands, in order,
+ # will be retrieved from environ:
+ # between -> capabilities -> heads -> branchmap -> unbundle -> unbundle -> listkeys
+ #
# The mercurial API unbundle() ( i.e., hg push ) method ultimately requires authorization.
- # We'll force password entry every time a change set is pushed. The user that pushes the changes
- # sets may not be the same user that committed the change sets. In other words, the user that is
- # pushing is the one being authenticated, but the owner of a specific change set in the change log
- # may be different.
+ # We'll force password entry every time a change set is pushed.
#
# When a user executes hg commit, it is not guaranteed to succeed. Mercurial records your name
# and address with each change that you commit, so that you and others will later be able to
@@ -40,7 +67,7 @@
# 1) If you specify a -u option to the hg commit command on the command line, followed by a username,
# this is always given the highest precedence.
# 2) If you have set the HGUSER environment variable, this is checked next.
- # 3) If you create a file in your home directory called .hgrc (~/.hgrc), with a username entry, that
+ # 3) If you create a file in your home directory called .hgrc with a username entry, that
# will be used next.
# 4) If you have set the EMAIL environment variable, this will be used next.
# 5) Mercurial will query your system to find out your local user name and host name, and construct
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/2eb45c152c10/
changeset: 2eb45c152c10
user: greg
date: 2011-06-30 20:07:55
summary: Fix a bug in the Galaxy tool shed I just introduced in my last commit.
affected #: 1 file (5 bytes)
--- a/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 30 12:13:20 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 30 14:07:55 2011 -0400
@@ -143,7 +143,7 @@
# Columns that are valid for filtering but are not visible.
EmailColumn( "Email",
model_class=model.User,
- key="User.email",
+ key="email",
visible=False ),
RepositoryCategoryColumn( "Category",
model_class=model.Category,
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/d713ce5d01d0/
changeset: d713ce5d01d0
user: natefoo
date: 2011-06-30 17:45:24
summary: Another fix for migration script 65 - the previous fix for MySQL broke PostgreSQL.
affected #: 1 file (433 bytes)
--- a/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py Wed Jun 29 13:27:01 2011 -0400
+++ b/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py Thu Jun 30 11:45:24 2011 -0400
@@ -10,6 +10,7 @@
from migrate.changeset import *
from sqlalchemy.exc import *
from galaxy.util.json import from_json_string, to_json_string
+from galaxy.model.custom_types import _sniffnfix_pg9_hex
import datetime
now = datetime.datetime.utcnow
@@ -52,14 +53,17 @@
fields = str( row[1] )
if not fields.strip():
continue
- fields_list = from_json_string( fields )
+ fields_list = from_json_string( _sniffnfix_pg9_hex( fields ) )
if len( fields_list ):
for index, field in enumerate( fields_list ):
field[ 'name' ] = 'field_%i' % index
field[ 'helptext' ] = field[ 'helptext' ].replace("'", "''").replace('"', "")
field[ 'label' ] = field[ 'label' ].replace("'", "''")
fields_json = to_json_string( fields_list )
- cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE f.id=%i" %( fields_json, form_definition_id )
+ if migrate_engine.name == 'mysql':
+ cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE f.id=%i" %( fields_json, form_definition_id )
+ else:
+ cmd = "UPDATE form_definition SET fields='%s' WHERE id=%i" %( fields_json, form_definition_id )
db_session.execute( cmd )
# replace the values list in the content field of the form_values table with a name:value dict
cmd = "SELECT form_values.id, form_values.content, form_definition.fields" \
@@ -121,15 +125,17 @@
cmd = "SELECT f.id, f.fields FROM form_definition AS f"
result = db_session.execute( cmd )
for row in result:
- og.debug("Line 124 ROW: %s" % str( row ))
form_definition_id = row[0]
fields = str( row[1] )
if not fields.strip():
continue
- fields_list = from_json_string( fields )
+ fields_list = from_json_string( _sniffnfix_pg9_hex( fields ) )
if len( fields_list ):
for index, field in enumerate( fields_list ):
if field.has_key( 'name' ):
del field[ 'name' ]
- cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE id=%i" %( to_json_string( fields_list ), form_definition_id )
+ if migrate_engine.name == 'mysql':
+ cmd = "UPDATE form_definition AS f SET f.fields='%s' WHERE f.id=%i" %( to_json_string( fields_list ), form_definition_id )
+ else:
+ cmd = "UPDATE form_definition SET fields='%s' WHERE id=%i" %( to_json_string( fields_list ), form_definition_id )
db_session.execute( cmd )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/ddd51b0d4556/
changeset: ddd51b0d4556
user: natefoo
date: 2011-06-29 17:07:37
summary: Allow viewing deleted datasets from /history/view.
affected #: 3 files (453 bytes)
--- a/lib/galaxy/web/controllers/history.py Tue Jun 28 16:19:30 2011 -0400
+++ b/lib/galaxy/web/controllers/history.py Wed Jun 29 11:07:37 2011 -0400
@@ -738,7 +738,7 @@
""" % ( web.url_for( id=id, confirm=True, referer=trans.request.referer ), referer_message ), use_panels=True )
@web.expose
- def view( self, trans, id=None ):
+ def view( self, trans, id=None, show_deleted=False ):
"""View a history. If a history is importable, then it is viewable by any user."""
# Get history to view.
if not id:
@@ -751,11 +751,12 @@
if not trans.user_is_admin() and not history_to_view.importable:
error( "Either you are not allowed to view this history or the owner of this history has not made it accessible." )
# View history.
- datasets = self.get_history_datasets( trans, history_to_view )
+ show_deleted = util.string_as_bool( show_deleted )
+ datasets = self.get_history_datasets( trans, history_to_view, show_deleted=show_deleted )
return trans.stream_template_mako( "history/view.mako",
history = history_to_view,
datasets = datasets,
- show_deleted = False )
+ show_deleted = show_deleted )
@web.expose
def display_by_username_and_slug( self, trans, username, slug ):
--- a/templates/history/view.mako Tue Jun 28 16:19:30 2011 -0400
+++ b/templates/history/view.mako Wed Jun 29 11:07:37 2011 -0400
@@ -84,7 +84,9 @@
<a href="${h.url_for( action='imp', id=trans.security.encode_id(history.id) )}">import and start using history</a> |
<a href="${get_history_link( history )}">${_('refresh')}</a>
%if show_deleted:
- | <a href="${h.url_for('history', show_deleted=False)}">${_('hide deleted')}</a>
+ | <a href="${h.url_for( id=trans.security.encode_id(history.id), show_deleted=False )}">${_('hide deleted')}</a>
+ %else:
+ | <a href="${h.url_for( id=trans.security.encode_id(history.id), show_deleted=True )}">${_('show deleted')}</a>
%endif
| <a href="#" class="toggle">collapse all</a></div>
--- a/templates/root/history_common.mako Tue Jun 28 16:19:30 2011 -0400
+++ b/templates/root/history_common.mako Wed Jun 29 11:07:37 2011 -0400
@@ -49,11 +49,14 @@
%if data.dataset.purged or data.purged:
This dataset has been deleted and removed from disk.
%else:
- This dataset has been deleted. Click <a href="${h.url_for( controller='dataset', action='undelete', id=data.id )}" class="historyItemUndelete" id="historyItemUndeleter-${data.id}" target="galaxy_history">here</a> to undelete
- %if trans.app.config.allow_user_dataset_purge:
- or <a href="${h.url_for( controller='dataset', action='purge', id=data.id )}" class="historyItemPurge" id="historyItemPurger-${data.id}" target="galaxy_history">here</a> to immediately remove it from disk.
- %else:
- it.
+ This dataset has been deleted.
+ %if for_editing:
+ Click <a href="${h.url_for( controller='dataset', action='undelete', id=data.id )}" class="historyItemUndelete" id="historyItemUndeleter-${data.id}" target="galaxy_history">here</a> to undelete
+ %if trans.app.config.allow_user_dataset_purge:
+ or <a href="${h.url_for( controller='dataset', action='purge', id=data.id )}" class="historyItemPurge" id="historyItemPurger-${data.id}" target="galaxy_history">here</a> to immediately remove it from disk.
+ %else:
+ it.
+ %endif
%endif
%endif
</strong></div>
@@ -151,7 +154,9 @@
An error occurred running this job: <i>${data.display_info().strip()}</i></div><div>
- <a href="${h.url_for( controller='dataset', action='errors', id=data.id )}" target="galaxy_main" title="View or report this error" class="icon-button bug tooltip"></a>
+ %if for_editing:
+ <a href="${h.url_for( controller='dataset', action='errors', id=data.id )}" target="galaxy_main" title="View or report this error" class="icon-button bug tooltip"></a>
+ %endif
%if data.has_data():
${render_download_links( data, dataset_id )}
%endif
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/6f7bcfffe6ff/
changeset: 6f7bcfffe6ff
user: greg
date: 2011-06-28 17:03:55
summary: Make sure the current authenticated user is the one that is associated with new committed change sets in the tool shed repositories.
affected #: 2 files (78 bytes)
--- a/lib/galaxy/webapps/community/controllers/repository.py Tue Jun 28 10:24:49 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Tue Jun 28 11:03:55 2011 -0400
@@ -424,7 +424,7 @@
if not commit_message:
commit_message = 'Deleted selected files'
# Commit the changes.
- commands.commit( repo.ui, repo, repo_dir, message=commit_message )
+ commands.commit( repo.ui, repo, repo_dir, user=trans.user.username, message=commit_message )
handle_email_alerts( trans, repository )
# Update the repository files for browsing.
update_for_browsing( repository, current_working_dir )
--- a/lib/galaxy/webapps/community/controllers/upload.py Tue Jun 28 10:24:49 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Tue Jun 28 11:03:55 2011 -0400
@@ -82,7 +82,7 @@
# Move the uploaded file to the load_point within the repository hierarchy.
shutil.move( uploaded_file_name, full_path )
commands.add( repo.ui, repo, full_path )
- commands.commit( repo.ui, repo, full_path, message=commit_message )
+ commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
handle_email_alerts( trans, repository )
if ok:
# Update the repository files for browsing, a by-product of doing this
@@ -162,7 +162,7 @@
for filename_in_archive in filenames_in_archive:
commands.add( repo.ui, repo, filename_in_archive )
# Commit the changes.
- commands.commit( repo.ui, repo, full_path, message=commit_message )
+ commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
handle_email_alerts( trans, repository )
return True, '', files_to_remove
def uncompress( self, repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 ):
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.