Example #1
0
def compile_configs():
    """Uses the modifiers per group to generate new permissions dictionaries
    and pickle them.
    """
    new_dict = {'BASE': BASE_PERMISSIONS}
    for mod in MODS:
        new_dict[mod] = mod_config(mod)
    # Now we have a new fat dictionary for each group.
    # Let's pickle it:
    with open('permits/configs/full.py', 'w') as f:
        pickle.dump(new_dict, f)
    # Now let's thin it into user_roles:
    narrow_dicts = {k: _spread_into_roles(v) for k, v in new_dict.items()}
    with open('permits/configs/narrow.py', 'w') as n:
        pickle.dump(narrow_dicts, n)
    # Lastly, let's compile our dictionary
    with open('permits/configs/traversals.py', 'w') as t:
        pickle.dump(methods.traversal_bits(BASE_PERMISSIONS), t)
Example #2
0
 def test_traversal_bits(self):
     reduced = permit.traversal_bits(self.testDict)
     print self.assertEqual(reduced['skillsets']['fields']['challenges'], 'm')
     print self.assertEqual(reduced['skillsets']['fields']['title'], '-')