Commits

George Notaras  committed fdd756d

Added signal callbacks that update the Record instances ``change_date`` field and fill missing TTL.

  • Participants
  • Parent commits a68cad0

Comments (0)

Files changed (1)

File src/powerdns_manager/signal_cb.py

 #  limitations under the License.
 #
 
+import time
+
 from django.db.models.loading import cache
 
+from powerdns_manager import settings
 
-def signal_callback(sender, **kwargs):
-    instance = kwargs['instance']   # app_label.ModelName instance
-    
+
+
+def update_rr_change_date(sender, **kwargs):
+    instance = kwargs['instance']   # powerdns_manager.Record instance
+    instance.change_date = int(time.time())
+
+
+def set_missing_ttl(sender, **kwargs):
+    instance = kwargs['instance']   # powerdns_manager.Record instance
+    instance.ttl = settings.PDNS_DEFAULT_RR_TTL
+    # TODO: consider checking the minimum TTL from the SOA record.
+