I am writing a web application (in Python, this is not important). One of the features is that people can leave comments on things. I have a class for comments, basically like this:
class Comment:
user = ...
# other stuff
where useris an instance of another class,
class User:
name = ...
# other stuff
And of course in my template I
<div>${comment.user.name}</div>
Problem: Let me say that I allow people to post comments anonymously. In this case, comment.userthere is None(undefined), and, of course, access to comment.user.namewill lead to an error. What is the best way to handle this? I see three possibilities:
- - . , , , " " ( "..." ), , . . , , , .
user Comment, , undefined. user.name = 'Anonymous' - , .- ,
user.name = Anonymous ( - ), , , . , . (PHPBB?)
, , ( - ) ? , , ? , , .