playframework/Play20 — pull request #29 by ornicar (2011-11-23 16:58:00+00:00)
Title: Replace unsafe call to Option.get with a for comprehension

Option.get shoud be avoided when possible. The language provides
tools to safely deal with Option in a nice, scalaish way.

An alternative using flatMap and map would be:

```scala
/**
* Display the dashboard.
*/
def index = Action { request =>
request.username flatMap { username =>
User.findByEmail(username) map { user =>
Ok(
html.dashboard(
Project.findInvolving(username),
Task.findTodoInvolving(username),
user
)
)
}
} getOrElse Unauthorized
}
```

But I find the for comprehension more readable.