diff options
author | Madhusudan.C.S | 2011-01-14 00:59:09 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2011-01-14 00:59:09 +0530 |
commit | bb35c0a7546440247dad47f57d748259d0e9a744 (patch) | |
tree | 76f740c37954d23da88fcd2af856f74a5bc1e9e5 /taskapp/events/user.py | |
parent | 8b708b1b475caad85e12022db6d3d9af3387fbfe (diff) | |
download | pytask-bb35c0a7546440247dad47f57d748259d0e9a744.tar.gz pytask-bb35c0a7546440247dad47f57d748259d0e9a744.tar.bz2 pytask-bb35c0a7546440247dad47f57d748259d0e9a744.zip |
Purging the repository for the new set of changes by Nishanth.
Diffstat (limited to 'taskapp/events/user.py')
-rw-r--r-- | taskapp/events/user.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/taskapp/events/user.py b/taskapp/events/user.py deleted file mode 100644 index 754cab0..0000000 --- a/taskapp/events/user.py +++ /dev/null @@ -1,56 +0,0 @@ -from django.contrib.auth.models import User -from pytask.taskapp.models import Profile, Task, Comment - -""" A collection of helper methods. note that there is no validation done here. -we take care of validation and others checks in methods that invoke these methods. -""" - -def updateProfile(user_profile, properties): - """ updates the given properties in the profile for a user. - args: - user_profile : a profile object - properties : a dictionary with attributes to set as keys and corresponding values - """ - - for attr,value in properties.items(): - user_profile.__setattr__(attr,value) - user_profile.save() - -def createUser(username,email,password,dob,gender): - """ create a user and create a profile and update its properties - args: - username : a username that does not exist - email : a valid email - password : a password - dob : a date object - gender : u'M'/u'F' - """ - - try: - user = User.objects.get(username=username) - return user - except: - user = User(username=username, email=email) - user.set_password(password) - user.save() - properties = {'dob':dob, 'gender':gender} - user_profile = Profile(user=user) - updateProfile(user_profile, properties) - return user - -def createSuUser(username,email,password,dob,gender): - """ create user using createUser method and set the is_superuser flag """ - - su_user = createUser(username,email,password,dob,gender) - su_user.is_staff = True - su_user.is_superuser = True - su_user.save() - return su_user - -def changeRole(role, user): - """ change the status of user to role. - """ - - user_profile = user.get_profile() - user_profile.rights = role - user_profile.save() |