update attribute

#58
by davanstrien HF staff - opened
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -140,7 +140,7 @@ def parse_hub_id_entry(hub_id: str) -> Union[str, List[str]]:
140
  def remove_user_from_tracking_datasets(dataset_id, profile: gr.OAuthProfile | None):
141
  if not profile and not local:
142
  return "You must be logged in to remove a dataset"
143
- username = profile.preferred_username
144
  dataset_id, match = parse_hub_id_entry(dataset_id)
145
  if isinstance(dataset_id, str):
146
  return _remove_user_from_tracking_datasets(dataset_id, username)
@@ -186,7 +186,7 @@ def user_unsubscribe_all(username):
186
  def user_update(hub_id, profile: gr.OAuthProfile | None):
187
  if not profile and not local:
188
  return "Please login to track a dataset"
189
- username = profile.preferred_username
190
  hub_id, match = parse_hub_id_entry(hub_id)
191
  if isinstance(hub_id, str):
192
  return _user_update(hub_id, username)
@@ -384,7 +384,7 @@ def _user_stats(username: str):
384
  def user_stats(profile: gr.OAuthProfile | None):
385
  if not profile and not local:
386
  return "You must be logged in to view datasets you are tracking"
387
- username = profile.preferred_username
388
  return _user_stats(username)
389
 
390
 
 
140
  def remove_user_from_tracking_datasets(dataset_id, profile: gr.OAuthProfile | None):
141
  if not profile and not local:
142
  return "You must be logged in to remove a dataset"
143
+ username = profile.username
144
  dataset_id, match = parse_hub_id_entry(dataset_id)
145
  if isinstance(dataset_id, str):
146
  return _remove_user_from_tracking_datasets(dataset_id, username)
 
186
  def user_update(hub_id, profile: gr.OAuthProfile | None):
187
  if not profile and not local:
188
  return "Please login to track a dataset"
189
+ username = profile.username
190
  hub_id, match = parse_hub_id_entry(hub_id)
191
  if isinstance(hub_id, str):
192
  return _user_update(hub_id, username)
 
384
  def user_stats(profile: gr.OAuthProfile | None):
385
  if not profile and not local:
386
  return "You must be logged in to view datasets you are tracking"
387
+ username = profile.username
388
  return _user_stats(username)
389
 
390