From 724c296e54714a949ce79c5056229e00fb7c15c2 Mon Sep 17 00:00:00 2001 From: guillaume Date: Tue, 10 Aug 2010 16:27:37 -0400 Subject: First code commit, with very few things. * Beginning of object class * Beginning of permission class --- permission.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 permission.py (limited to 'permission.py') diff --git a/permission.py b/permission.py new file mode 100755 index 0000000..310cef2 --- /dev/null +++ b/permission.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +#TODO : move the globals to a config file (use the config file parser module) +PERM_LIST=['READ','MODIFY','APPEND'] #just add a string here to define a new permission +PERMS = len(PERM_LIST) +MAX = (1< MAX) or (init < 0) : + raise PermissionError('Permission int not in correct range') + result = [] + for shift in range(PERMS-1,-1,-1) : + if init>>shift : + result.append(PERM_LIST[shift]) + init = init-(1<