From bd7bc3b57abb5a01c91a3f38fca546edabe58e50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com>
Date: Mon, 18 Aug 2014 02:30:46 +0200
Subject: [PATCH] Don't crash on null edit

Null edits won't include 'newtimestamp' in the response
---
 mwclient/page.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mwclient/page.py b/mwclient/page.py
index 336bfc1..65b9a59 100644
--- a/mwclient/page.py
+++ b/mwclient/page.py
@@ -202,7 +202,9 @@ class Page(object):
                 self.handle_edit_error(e, summary)
 
         if result['edit'].get('result') == 'Success':
-            self.last_rev_time = client.parse_timestamp(result['edit'].get('newtimestamp'))
+            lrt = result['edit'].get('newtimestamp')
+            if lrt:  # It's not included if no change was made
+                self.last_rev_time = client.parse_timestamp(lrt)
         return result['edit']
 
     def handle_edit_error(self, e, summary):
-- 
GitLab