File tree 2 files changed +10
-5
lines changed
src/ch16-mongodb-version/final/pypi_nosql/pypi
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
- import bson
2
1
from typing import Optional
3
2
4
- from pypi import DbSession
5
- from pypi . nosql . users import User
3
+ # noinspection PyPackageRequirements
4
+ import bson
6
5
from passlib .handlers .sha2_crypt import sha512_crypt
7
6
7
+ from pypi .nosql .users import User
8
+
8
9
9
10
def user_count () -> int :
10
11
return User .objects ().count ()
Original file line number Diff line number Diff line change
1
+ from typing import Optional
2
+
3
+ # noinspection PyPackageRequirements
4
+ import bson
1
5
from pyramid .request import Request
2
6
3
7
from pypi .infrastructure import request_dict , cookie_auth
@@ -7,8 +11,8 @@ class ViewModelBase:
7
11
def __init__ (self , request : Request ):
8
12
self .request = request
9
13
self .request_dict = request_dict .create (request )
10
- self .error : str = None
11
- self .user_id : int = cookie_auth .get_user_id_via_auth_cookie (request )
14
+ self .error : Optional [ str ] = None
15
+ self .user_id : bson . ObjectId = cookie_auth .get_user_id_via_auth_cookie (request )
12
16
13
17
def to_dict (self ):
14
18
return self .__dict__
You can’t perform that action at this time.
0 commit comments