Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from control.html import HtmlElements as H 

2from control.typ.value import Value 

3 

4 

5class User(Value): 

6 """Type class for users. 

7 

8 !!! note 

9 This is an example of a type class that needs 

10 `control.auth.Auth` (which it gets through 

11 `control.context.Context`) in order 

12 to display titles for users cautiously. 

13 

14 !!! caution 

15 Do not reveal too many details to unauthenticated users. 

16 """ 

17 

18 needsContext = True 

19 

20 def __init__(self, context): 

21 super().__init__(context) 

22 

23 def titleStr(self, record, markup=True): 

24 context = self.context 

25 auth = context.auth 

26 

27 valBare = auth.identity(record, markup=markup) 

28 return valBare if markup is None else H.he(valBare)