define_accessors accepts a list of classes if needed
[plcapi.git] / PLC / Accessors / Accessors_site.py
1 #
2 # Thierry Parmentelat - INRIA
3 #
4 # Accessors_site.py is the place where you can define your own local tag accessors
5 # this will not be overwritten through rpm upgrades
6 #
7 # Historical note: now that Sites are taggable too, the name may be confusing, 
8 # think of this as Accessors_local.py
9 #
10 # to ensure creation of new tag_types, just run 
11 #   service plc start accessors
12 # also for the running API to take the new accessors into account, you need to
13 #   apachectl restart
14 # or to stay on the safe side, simply do
15 #   service plc restart
16 #
17 # methods denotes the set of methods (names) that get inserted into the API
18 # it is updated by define_accessors
19
20 methods=[]
21
22 from PLC.Nodes import Node
23 from PLC.Interfaces import Interface
24 from PLC.Slices import Slice
25 from PLC.Sites import Site
26 from PLC.Persons import Person
27 #from PLC.Ilinks import Ilink
28
29 from PLC.Accessors.Factory import define_accessors, all_roles, person_roles, tech_roles
30
31 import sys
32 current_module = sys.modules[__name__]
33
34 #### example : attach vlan ids on interfaces
35 # The third argument expose_in_api is a boolean flag that tells whether this tag may be handled
36 #   through the Add/Get/Update methods as a native field
37 #
38 #define_accessors(current_module, Interface, "Vlan", "vlan",
39 #                  "interface/general", "tag for setting VLAN id",
40 #                  get_roles=all_roles, set_roles=tech_roles)