MCPcopy Index your code
hub / github.com/ddserver/ddserver / __getitem__

Method __getitem__

ddserver/interface/user.py:45–64  ·  view source on GitHub ↗

Returns the user record for the given username. @param key: the username @return: the user record or None if no such user exists

(self,
                  key,
                  db)

Source from the content-addressed store, hash-verified

43
44 @require(db = 'ddserver.db:Database')
45 def __getitem__(self,
46 key,
47 db):
48 ''' Returns the user record for the given username.
49
50 @param key: the username
51
52 @return: the user record or None if no such user exists
53 '''
54
55 with db.cursor() as cur:
56 cur.execute('''
57 SELECT *
58 FROM users
59 WHERE username = %(username)s
60 ''', {'username': key})
61 row = cur.fetchone()
62
63 if row:
64 return self.User(**row)
65
66
67 @require(session = 'ddserver.interface.session:SessionManager',

Callers

nothing calls this directly

Calls 1

cursorMethod · 0.80

Tested by

no test coverage detected