sebastien/cuisine — pull request #95 by lost-theory (2012-07-23 16:00:48+00:00)
Title: Fix some logic with MODE_SUDO, MODE_LOCAL, mode(), sudo()

There were still some places using:

```
if MODE_SUDO:
if MODE_LOCAL:
```

Instead of the new ```mode``` function. I also noticed that a lot of the file/dir functions take a ```mode``` keyword argument, which conflicts with that ```mode``` function. So, I renamed ```mode``` to ```get_mode``` and fixed those places that were still checking the old global variable.

I also tried to do the same with "sudo" (keyword argument for some functions) vs. "sudo" (the function), but didn't want to rename either since that's a larger change which could break others' code. So that is still a problem (see issue #94).

Also, just for curiosity, why are there two ways to trigger sudo mode (using ```with mode_sudo()``` for some things and using the ```sudo=True``` keyword arg for other things)? I think it would be clearer if there were just one way (using ```with mode_sudo()```). Doing it that way you could also remove a lot of the conditional logic inside functions trying to detect MODE_SUDO vs. the sudo keyword arg.