Pascal Pfiffner

Results 97 comments of Pascal Pfiffner
trafficstars

`isset` has the same limitation as `empty`, though, both only accept variables.

What I'm trying to achieve is stuff like `{% if user.hasAccess %}`. I'm for now solving this by stuffing a `userHasAccess` variable into my render dict, but I think it...

It seems the `empty` function is as null-safe as `isset`, is it not? Anyway, @crodas I like your idea.

I don't understand your point, `isset` will return true for quite some situations when `empty` is probably the better choice, such as empty strings and arrays. `empty` handles NULL just...

> But the empty() method consider a boolean setted to false like an empty vars (0), so we need to cast boolean values and treat them appart otherwhise we'll probably...

Just found that this issue also affects variables. This works: ``` {{ user.name }} ``` This throws the same error (_"Fatal error: Can't use method return value in write context"_):...

No, I mean variables, printing `name` of the `user` object or "Unknown" if the user has no name: ``` {{ user.name|default:'Unknown' }} ```

I don't believe that should be necessary, as a) `{{ user.name }}` works fine and so the filters should work as well, and b) this works in Django.

I have PHP 5.4, so does my server where I can't upgrade PHP.

Yes, that would be better indeed! And while I'm Swiss I'm not originally from Zurich, I worked there for a while.