dc4dc74eb9e0b860f56347141d6d3e1ae76bd9ad
braney
  Fri May 30 15:09:18 2014 -0700
clean up some code for opening trackHubs, removed hgHubConnectCgiDestUrlcart variable, added ability to tell CGI's to default to a particular
database supported by a hub

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index afa2672..c2c1229 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -687,34 +687,40 @@
     else if (cartVarExists(cart, hgsDoLoadUrl))
 	{
 	setUdcCacheDir();
 	char *url = cartString(cart, hgsLoadUrlName);
 	struct lineFile *lf = netLineFileOpen(url);
 	cartLoadSettings(lf, cart, oldVars, hgsDoLoadUrl);
 	lineFileClose(&lf);
 	cartTrace(cart, "after cartLS", conn);
 	}
     }
 #endif /* GBROWSE */
 
 /* wire up the assembly hubs so we can operate without sql */
 setUdcTimeout(cart);
 if (cartVarExists(cart, hgHubDoDisconnect))
-    {
     doDisconnectHub(cart);
+
+char *newDatabase = hubConnectLoadHubs(cart);
+
+if (newDatabase != NULL)
+    {
+    cartSetString(cart,"db", newDatabase);
+    // this is some magic to use the defaultPosition */
+    cartSetString(cart,"position", "genome");
     }
-hubConnectLoadHubs(cart);
 
 if (exclude != NULL)
     {
     while ((ex = *exclude++))
 	cartExclude(cart, ex);
     }
 
 cartDefaultDisconnector(&conn);
 return cart;
 }
 
 
 
 static void updateOne(struct sqlConnection *conn,
 	char *table, struct cartDb *cdb, char *contents, int contentSize)