astitcher commented on a change in pull request #192: Changed Python API to 
better handle strings where symbo…
URL: https://github.com/apache/qpid-proton/pull/192#discussion_r334083036
 
 

 ##########
 File path: python/proton/_endpoints.py
 ##########
 @@ -500,6 +500,79 @@ def free(self):
         """
         pn_connection_release(self._impl)
 
+    def _get_offered_capabilities(self):
+        return self.offered_capabilities_list
+    def _set_offered_capabilities(self, offered_capability_list):
+        if isinstance(offered_capability_list, list):
+            self.offered_capabilities_list = 
SymbolList(offered_capability_list, throw=False)
+        else:
+            self.offered_capabilities_list = offered_capability_list
+    offered_capabilities = property(_get_offered_capabilities, 
_set_offered_capabilities, doc="""
+    Offered capabilities as a list of symbols. The AMQP 1.0 specification
+    restricts this list to symbol elements only. It is possible to use
+    the special ``list`` subclass :class:`SymbolList` as it will by
+    default enforce this restriction on construction. In addition, if a
+    string type is used, it will be silently converted into the required
+    symbol.
+
+        >>> from proton import symbol, Connection, SymbolList
+        >>> c = Connection()
+        >>> c.offered_capabilities = SymbolList(['one', symbol('two')])
+        >>> c.offered_capabilities
+        SymbolList([symbol('one'), symbol('two')])
+
+    :type: ``list`` containing :class:`symbol`.
+    """)
 
 Review comment:
   I don't think this very long explanation and example should be in this 
location - it is more of a tutorial IMO.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to