Setting tag plcapi-5.4-2
[plcapi.git] / PLC / Accessors / Accessors_site.py
index 1816117..b51d42e 100644 (file)
@@ -1,8 +1,18 @@
+#
 # Thierry Parmentelat - INRIA
-# $Id$
 #
-# Shortcuts_site.py is the place where you can define your own tag accessors
-# this will not be overwritten through rpm upgrades in a myplc-devel packaging
+# Accessors_site.py is the place where you can define your own local tag accessors
+# this will not be overwritten through rpm upgrades
+#
+# Historical note: now that Sites are taggable too, the name may be confusing, 
+# think of this as Accessors_local.py
+#
+# to ensure creation of new tag_types, just run 
+#   service plc start accessors
+# also for the running API to take the new accessors into account, you need to
+#   apachectl restart
+# or to stay on the safe side, simply do
+#   service plc restart
 #
 # methods denotes the set of methods (names) that get inserted into the API
 # it is updated by define_accessors
@@ -12,13 +22,27 @@ methods=[]
 from PLC.Nodes import Node
 from PLC.Interfaces import Interface
 from PLC.Slices import Slice
-from PLC.Ilinks import Ilink
+from PLC.Sites import Site
+from PLC.Persons import Person
 
-from PLC.Accessors.Factory import define_accessors, all_roles, tech_roles
+from PLC.Accessors.Factory import define_accessors, all_roles, person_roles, tech_roles
 
 import sys
 current_module = sys.modules[__name__]
 
 #### example : attach vlan ids on interfaces
-###define_accessors(current_module, Interface, "Vlan", "vlan","interface/general", "tag for setting VLAN id",
-###                 get_roles=all_roles, set_roles=tech_roles)
+#
+#define_accessors(current_module, Interface, "Vlan", "vlan",
+#                  "interface/general", "tag for setting VLAN id",
+#                  get_roles=all_roles, set_roles=tech_roles)
+#
+# The optional expose_in_api is a boolean flag that tells whether this tag may be handled
+#   through the Add/Get/Update methods as a native field
+# e.g. 
+#define_accessors(current_module, Node, "Foo", "foo",
+#                  "node/example", "my own description for foo",
+#                  get_roles=all_roles, set_roles=all_roles)
+# will let you do
+# GetNodes ( {'foo':'*bar*'},['hostname','foo'])
+#
+#