Repository: oppia/oppia

Issue:
Fix part of #2394:  add docstrings to config_services.py
IMPORTANT NOTES (please read, then delete):

* The PR title should start with "Fix #bugnum: " (if applicable), followed by a clear one-line present-tense summary of the changes introduced in the PR. For example: "Fix #bugnum: introduce the first version of the collection editor.".

* Please make sure to mention "#bugnum" somewhere in the description of the PR. This enables Github to link the PR to the corresponding bug.

Please also make sure to follow the [style rules](https://github.com/oppia/oppia/blob/develop/CONTRIBUTING.md#style-rules).



Discussion:

Resolving patch:
diff --git a/core/domain/config_domain.py b/core/domain/config_domain.py
--- a/core/domain/config_domain.py
+++ b/core/domain/config_domain.py
@@ -103,8 +103,7 @@ class ConfigProperty(object):
     def refresh_default_value(self, default_value):
         pass
 
-    def __init__(self, name, schema, description, default_value,
-                 is_directly_settable=True):
+    def __init__(self, name, schema, description, default_value):
         if Registry.get_config_property(name):
             raise Exception('Property with name %s already exists' % name)
 
@@ -113,7 +112,6 @@ def __init__(self, name, schema, description, default_value,
         self._description = description
         self._default_value = schema_utils.normalize_against_schema(
             default_value, self._schema)
-        self._is_directly_settable = is_directly_settable
 
         Registry.init_config_property(self.name, self)
 
@@ -133,10 +131,6 @@ def description(self):
     def default_value(self):
         return self._default_value
 
-    @property
-    def is_directly_settable(self):
-        return self._is_directly_settable
-
     @property
     def value(self):
         """Get the latest value from memcache, datastore, or use default."""
@@ -205,12 +199,11 @@ def get_config_property_schemas(cls):
         schemas_dict = {}
 
         for (property_name, instance) in cls._config_registry.iteritems():
-            if instance.is_directly_settable:
-                schemas_dict[property_name] = {
-                    'schema': instance.schema,
-                    'description': instance.description,
-                    'value': instance.value
-                }
+            schemas_dict[property_name] = {
+                'schema': instance.schema,
+                'description': instance.description,
+                'value': instance.value
+            }
 
         return schemas_dict
 
diff --git a/core/domain/config_services.py b/core/domain/config_services.py
--- a/core/domain/config_services.py
+++ b/core/domain/config_services.py
@@ -24,24 +24,33 @@
 
 
 def set_property(committer_id, name, value):
-    """Sets a property value. The property must already be registered."""
+    """Sets a property value. The property must already be registered.
+    Args:
+        committer_id: str. The user ID of the committer.
+        name: str. The name of the property.
+        value: str. The value of the property.
+    Raises:
+        Exception: No config property with the specified name is found.
+    """
 
     config_property = config_domain.Registry.get_config_property(name)
     if config_property is None:
-        raise Exception('No config property with name %s found.')
-
-    if not config_property.is_directly_settable:
-        raise Exception(
-            'Cannot modify value of config property %s directly' % name)
+        raise Exception('No config property with name %s found.' % name)
 
     config_property.set_value(committer_id, value)
 
 
 def revert_property(committer_id, name):
-    """Reverts a property value to the default value."""
+    """Reverts a property value to the default value.
+    Args:
+        committer_id: str. The user ID of the committer.
+        name: str. The name of the property.
+    Raises:
+        Exception: No config property with the specified name is found.
+    """
 
     config_property = config_domain.Registry.get_config_property(name)
     if config_property is None:
-        raise Exception('No config property with name %s found.')
+        raise Exception('No config property with name %s found.' % name)
 
     set_property(committer_id, name, config_property.default_value)


Test patch: