added comment on how to modify accessors
[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 # to ensure creation of new tag_types, just run 
8 #   service plc start accessors
9 # also for the running service to take the new accessors into account, you need to
10 #   apachectl restart
11 # or to stay on the safe side, simply do
12 #   service plc restart
13 #
14 # please note however that if a tag_type already exists in the DB, then 
15 # changing the corresponding accessors creation code WILL NOT alter the 
16 # tag_type in the DB; that applies to roles and other desc. or categ. 
17 # you will thus need to apply them manually 
18 #
19 # Now that Sites are taggable too, the name may be confusing, think of is as
20 # Accessors_local.py
21 #
22 # methods denotes the set of methods (names) that get inserted into the API
23 # it is updated by define_accessors
24
25 methods=[]
26
27 from PLC.Nodes import Node
28 from PLC.Interfaces import Interface
29 from PLC.Slices import Slice
30 from PLC.Sites import Site
31 from PLC.Persons import Person
32 #from PLC.Ilinks import Ilink
33
34 from PLC.Accessors.Factory import define_accessors, all_roles, person_roles, tech_roles
35
36 import sys
37 current_module = sys.modules[__name__]
38
39 #### example : attach vlan ids on interfaces
40 # The third argument expose_in_api is a boolean flag that tells whether this tag may be handled
41 #   through the Add/Get/Update methods as a native field
42 #
43 #define_accessors(current_module, Interface, "Vlan", "vlan",
44 #                  "interface/general", "tag for setting VLAN id",
45 #                  get_roles=all_roles, set_roles=tech_roles)