Changeset 39b1497 in OpenWorkouts-current


Ignore:
Timestamp:
Dec 14, 2018, 12:57:33 PM (4 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
929097a
Parents:
5ec3a0b
Message:

Replaced user_id leftovers with uid

Location:
ow
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • ow/models/root.py

    r5ec3a0b r39b1497  
    6262        return [u for u in self.values() if isinstance(u, User)]
    6363
    64     def get_user(self, user_id):
    65         return self.get(user_id, None)
     64    def get_user(self, uid):
     65        return self.get(uid, None)
    6666
    67     def add_user(self, user_id, **kw):
     67    def add_user(self, uid, **kw):
    6868        u = User(**kw)
    69         self[user_id] = u
     69        self[uid] = u
    7070
    7171    @property
  • ow/schemas/user.py

    r5ec3a0b r39b1497  
    5151    allow_extra_fields = True
    5252    filter_extra_fields = True
    53     user_id = validators.UnicodeString()
     53    uid = validators.UnicodeString()
    5454    firstname = validators.UnicodeString()
    5555    lastname = validators.UnicodeString()
  • ow/security.py

    r5ec3a0b r39b1497  
    11
    22
    3 def groupfinder(user_id, request):
     3def groupfinder(uid, request):
    44    """
    55    Return the groups a user belongs to.
     
    99    allow other users to view workouts from a given user
    1010    """
    11     if user_id in request.root.all_usernames():
    12         return [user_id]
     11    if uid in request.root.all_usernames():
     12        return [uid]
    1313    return []
  • ow/templates/add_user.pt

    r5ec3a0b r39b1497  
    2222
    2323      <fieldset>
    24         ${form.errorlist('user_id')}
     24        ${form.errorlist('uid')}
    2525        <label for="email" i18n:translate="">User ID:</label>
    26         ${form.text('user_id')}
     26        ${form.text('uid')}
    2727        ${form.errorlist('email')}
    2828        <label for="email" i18n:translate="">E-Mail:</label>
  • ow/templates/profile.pt

    r5ec3a0b r39b1497  
    2121      <h2>
    2222        <tal:fullname tal:content="context.fullname"></tal:fullname>
    23         (<tal:user_id tal:content="context.user_id"></tal:user_id>)
     23        (<tal:uid tal:content="context.uid"></tal:uid>)
    2424      </h2>
    2525      <h3>
  • ow/templates/user_list.pt

    r5ec3a0b r39b1497  
    2626      </thead>
    2727      <tal:r tal:repeat="user users">
    28       <tr tal:attributes="id 'user-' + user.user_id">
     28      <tr tal:attributes="id 'user-' + str(user.uid)">
    2929        <td>${user.fullname}</td>
    3030        <td>${user.email}</td>
  • ow/tests/models/test_root.py

    r5ec3a0b r39b1497  
    3030
    3131    def test_lowercase_usernames(self, root):
    32         root.add_user(user_id='Jack', firstname='Jack', lastname='Dumb',
     32        root.add_user(uid='Jack', firstname='Jack', lastname='Dumb',
    3333                      email='jack.dumb@example.net')
    3434        assert root.lowercase_usernames() == ['jack', 'john']
     
    3838
    3939    def test_lowercase_emails(self, root):
    40         root.add_user(user_id='Jack', firstname='Jack', lastname='Dumb',
     40        root.add_user(uid='Jack', firstname='Jack', lastname='Dumb',
    4141                      email='Jack.Dumb@example.net')
    4242        assert root.lowercase_emails() == ['jack.dumb@example.net',
     
    5555    def test_add_user(self, root):
    5656        assert len(root.users()) == 1
    57         root.add_user(user_id='jack', firstname='Jack', lastname='Dumb',
     57        root.add_user(uid='jack', firstname='Jack', lastname='Dumb',
    5858                      email='jack.dumb@example.net')
    5959        assert len(root.users()) == 2
  • ow/tests/views/test_root.py

    r5ec3a0b r39b1497  
    7373    def test_add_user_post_valid(self, post_request):
    7474        request = post_request
    75         request.POST['user_id'] = 'addeduser'
     75        request.POST['uid'] = 'addeduser'
    7676        request.POST['email'] = 'addeduser@example.net'
    7777        request.POST['firstname'] = 'added'
  • ow/views/root.py

    r5ec3a0b r39b1497  
    3434
    3535    if 'submit' in request.POST and form.validate():
    36         user_id = request.POST['user_id']
    37         user = form.bind(User(), exclude=['user_id'])
    38         context[user_id] = user
     36        uid = request.POST['uid']
     37        user = form.bind(User(), exclude=['uid'])
     38        context[uid] = user
    3939        return HTTPFound(location=request.resource_url(context, 'userlist'))
    4040
Note: See TracChangeset for help on using the changeset viewer.