This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponseRedirect | |
def has_perm_or_redirect(permission, redirect): | |
def wrapper(function): | |
def wrapped_function(request, *args, **kwargs): | |
if request.user.has_perm("tpd4.NONE"): | |
print request.user.has_perm("blah") | |
return function(request, *args, **kwargs) | |
else: | |
return HttpResponseRedirect(redirect) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
data1 = {'a': [1, 2.0, 3, 4+6j], | |
'b': ('string', u'Unicode string'), | |
'c': None} | |
selfref_list = [1, 2, 3] | |
selfref_list.append(selfref_list) | |
output = open('data.pkl', 'wb') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# led.py - Sample classes and methods to get you started with LED's the OOP way. | |
def send_val_to_pin(pin, colorval): | |
print "Pin: %s | ColorVal: %s" % (str(pin), str(colorval)) | |
class LED: | |
def __init__(self, pin_r, pin_g, pin_b): | |
self.pin_r = pin_r | |
self.pin_g = pin_g |
NewerOlder