Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/features/hotlist_helpers.py b/features/hotlist_helpers.py
index f23f72e..1c4dcbf 100644
--- a/features/hotlist_helpers.py
+++ b/features/hotlist_helpers.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Helper functions and classes used by the hotlist pages."""
from __future__ import print_function
@@ -333,36 +332,35 @@
def GetURLOfHotlist(cnxn, hotlist, user_service, url_for_token=False):
- """Determines the url to be used to access the given hotlist.
+ """Determines the url to be used to access the given hotlist.
- Args:
- cnxn: connection to SQL database
- hotlist: the hotlist_pb
- user_service: interface to user data storage
- url_for_token: if true, url returned will use user's id
- regardless of their user settings, for tokenization.
+ Args:
+ cnxn: connection to SQL database
+ hotlist: the hotlist_pb
+ user_service: interface to user data storage
+ url_for_token: if true, url returned will use user's id
+ regardless of their user settings, for tokenization.
- Returns:
- The string url to be used when accessing this hotlist.
- """
- if not hotlist.owner_ids: # Should never happen.
- logging.error('Unowned Hotlist: id:%r, name:%r', hotlist.hotlist_id,
- hotlist.name)
- return ''
- owner_id = hotlist.owner_ids[0] # only one owner allowed
- owner = user_service.GetUser(cnxn, owner_id)
- if owner.obscure_email or url_for_token:
- return '/u/%d/hotlists/%s' % (owner_id, hotlist.name)
- return (
- '/u/%s/hotlists/%s' % (
- owner.email, hotlist.name))
+ Returns:
+ The string url to be used when accessing this hotlist.
+ """
+ if not hotlist.owner_ids: # Should never happen.
+ logging.error(
+ 'Unowned Hotlist: id:%r, name:%r', hotlist.hotlist_id, hotlist.name)
+ return ''
+ owner_id = hotlist.owner_ids[0] # only one owner allowed
+ owner = user_service.GetUser(cnxn, owner_id)
+ if owner.obscure_email or url_for_token:
+ return '/u/%d/hotlists/%s' % (owner_id, hotlist.name)
+ return ('/u/%s/hotlists/%s' % (owner.email, hotlist.name))
def RemoveHotlist(cnxn, hotlist_id, services):
"""Removes the given hotlist from the database.
- Args:
- hotlist_id: the id of the hotlist to be removed.
- services: interfaces to data storage.
+
+ Args:
+ hotlist_id: the id of the hotlist to be removed.
+ services: interfaces to data storage.
"""
services.hotlist_star.ExpungeStars(cnxn, hotlist_id)
services.user.ExpungeHotlistsFromHistory(cnxn, [hotlist_id])