Added some comments
authorStas Shtin <antisvin@gmail.com>
Sun, 18 Apr 2010 20:51:47 +0000 (00:51 +0400)
committerStas Shtin <antisvin@gmail.com>
Sun, 18 Apr 2010 20:51:47 +0000 (00:51 +0400)
src/ipypbx/http.py

index b470c4b..285c4ec 100644 (file)
@@ -235,6 +235,9 @@ class FreeswitchConfigGenerator(object):
     database = property(database)
 
     def canHandle(self, params):
     database = property(database)
 
     def canHandle(self, params):
+        """
+        Check if this generator can handle a request from freeswitch.
+        """
         for key, value in self.param_match.iteritems():
             if params.get(key, None) != value:
                 return False
         for key, value in self.param_match.iteritems():
             if params.get(key, None) != value:
                 return False
@@ -253,6 +256,9 @@ class FreeswitchConfigGenerator(object):
 
     @staticmethod
     def addParams(parent_elt, params):
 
     @staticmethod
     def addParams(parent_elt, params):
+        """
+        Create params element based on data passed in a list.
+        """
         for name, value in params:
             etree.SubElement(
                 parent_elt, 'param', name=name, value=str(value))
         for name, value in params:
             etree.SubElement(
                 parent_elt, 'param', name=name, value=str(value))
@@ -285,6 +291,7 @@ class SofiaConfGenerator(FreeswitchConfigGenerator):
             from ipypbxweb_sipprofile where connection_id = %i
             ''' % self.parent.connection_id)
         while profiles_query.next():
             from ipypbxweb_sipprofile where connection_id = %i
             ''' % self.parent.connection_id)
         while profiles_query.next():
+            # Create profile element.
             profile_id, _ok = profiles_query.value(0).toInt()
             profile_elt = etree.SubElement(
                 profiles_elt, 'profile',
             profile_id, _ok = profiles_query.value(0).toInt()
             profile_elt = etree.SubElement(
                 profiles_elt, 'profile',
@@ -334,6 +341,7 @@ class SofiaConfGenerator(FreeswitchConfigGenerator):
                 from ipypbxweb_gateway where sip_profile_id = %i
                 '''  % profile_id)
             while gateways_query.next():
                 from ipypbxweb_gateway where sip_profile_id = %i
                 '''  % profile_id)
             while gateways_query.next():
+                # Create gateway element.
                 gateway_elt = etree.SubElement(
                     gateways_elt, 'gateway', name=gateways_query.value(0).toString())
                 retry_seconds, _ok = gateways_query.value(5).toInt()
                 gateway_elt = etree.SubElement(
                     gateways_elt, 'gateway', name=gateways_query.value(0).toString())
                 retry_seconds, _ok = gateways_query.value(5).toInt()