Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(layout): Encourage use of username with set_user #22

Merged
merged 3 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ch_util/_db_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ def set_user(u):
Parameters
----------
u : string or integer
Your user identifier: the integer id, the username, or the full name.
One of:
- your CHIMEwiki username (string). Use an initial capital letter.
This is the recommended input.
- the name entered into the "real name" field in your CHIMEwiki profile
- your CHIMEwiki integer user_id (not easy to find)

Raises
------
Expand Down Expand Up @@ -222,7 +226,11 @@ def _check_user(perm):
)
raise NoPermission("You do not have the permissions to %s." % p.long_name)
except pw.DoesNotExist:
raise RuntimeError("Wow, code is broken.")
ketiltrout marked this conversation as resolved.
Show resolved Hide resolved
raise RuntimeError(
"Internal error: _check_user called with unknown permission: {}".format(
perm
)
)


def _peewee_get_current_user():
Expand Down
9 changes: 5 additions & 4 deletions ch_util/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@

If you will be altering the layouts, you will need to register as a user:

>>> layout.set_user("Adam Hincks")
>>> layout.set_user("Ahincks")

Your user account is shared with the CHIME wiki. Note that different users have
different permissions, stored in the :class:`user_permission` table. If you are
simply reading from the layout, there is no need to register as a user.
Use your CHIME wiki username here. Make sure it starts with a capital letter.
Note that different users have different permissions, stored in the
:class:`user_permission` table. If you are simply reading from the layout,
there is no need to register as a user.

Choose Your Own Adventure
=========================
Expand Down