Show More
@@ -300,12 +300,13 b' short_id = lambda x: x[:12]' | |||||
300 | hide_credentials = lambda x: ''.join(credentials_filter(x)) |
|
300 | hide_credentials = lambda x: ''.join(credentials_filter(x)) | |
301 |
|
301 | |||
302 |
|
302 | |||
303 |
def email_or_none( |
|
303 | def email_or_none(author): | |
304 | if email(x) != '': |
|
304 | _email = email(author) | |
305 | return email(x) |
|
305 | if _email != '': | |
|
306 | return _email | |||
306 |
|
307 | |||
307 | # See if it contains a username we can get an email from |
|
308 | # See if it contains a username we can get an email from | |
308 |
user = User.get_by_username(author_name( |
|
309 | user = User.get_by_username(author_name(author), case_insensitive=True, | |
309 | cache=True) |
|
310 | cache=True) | |
310 | if user is not None: |
|
311 | if user is not None: | |
311 | return user.email |
|
312 | return user.email | |
@@ -313,26 +314,27 b' def email_or_none(x):' | |||||
313 | # No valid email, not a valid user in the system, none! |
|
314 | # No valid email, not a valid user in the system, none! | |
314 | return None |
|
315 | return None | |
315 |
|
316 | |||
316 |
def person( |
|
317 | def person(author): | |
317 | # Valid email in the attribute passed, see if they're in the system |
|
|||
318 |
|
||||
319 | # attr to return from fetched user |
|
318 | # attr to return from fetched user | |
320 | person_getter = lambda usr: usr.username |
|
319 | person_getter = lambda usr: usr.username | |
321 |
|
320 | |||
322 | if email(x) != '': |
|
321 | # Valid email in the attribute passed, see if they're in the system | |
323 | user = User.get_by_email(email(x), case_insensitive=True, cache=True) |
|
322 | _email = email(author) | |
|
323 | if _email != '': | |||
|
324 | user = User.get_by_email(_email, case_insensitive=True, cache=True) | |||
324 | if user is not None: |
|
325 | if user is not None: | |
325 | return person_getter(user) |
|
326 | return person_getter(user) | |
326 |
return email |
|
327 | return _email | |
327 |
|
328 | |||
328 | # Maybe it's a username? |
|
329 | # Maybe it's a username? | |
329 | user = User.get_by_username(author_name(x), case_insensitive=True, |
|
330 | _author = author_name(author) | |
|
331 | user = User.get_by_username(_author, case_insensitive=True, | |||
330 | cache=True) |
|
332 | cache=True) | |
331 | if user is not None: |
|
333 | if user is not None: | |
332 | return person_getter(user) |
|
334 | return person_getter(user) | |
333 |
|
335 | |||
334 | # Still nothing? Just pass back the author name then |
|
336 | # Still nothing? Just pass back the author name then | |
335 |
return author |
|
337 | return _author | |
336 |
|
338 | |||
337 | def bool2icon(value): |
|
339 | def bool2icon(value): | |
338 | """Returns True/False values represented as small html image of true/false |
|
340 | """Returns True/False values represented as small html image of true/false |
General Comments 0
You need to be logged in to leave comments.
Login now