@@ -859,11 +859,12 @@ def get_all(doctype, *args, **kwargs): | |||||
def add_version(doc): | def add_version(doc): | ||||
"""Insert a new **Version** of the given document. | """Insert a new **Version** of the given document. | ||||
A **Version** is a JSON dump of the current document state.""" | A **Version** is a JSON dump of the current document state.""" | ||||
from frappe.utils.response import json_handler | |||||
get_doc({ | get_doc({ | ||||
"doctype": "Version", | "doctype": "Version", | ||||
"ref_doctype": doc.doctype, | "ref_doctype": doc.doctype, | ||||
"docname": doc.name, | "docname": doc.name, | ||||
"doclist_json": json.dumps(doc.as_dict(), indent=1, sort_keys=True) | |||||
"doclist_json": json.dumps(doc.as_dict(), indent=1, sort_keys=True, default=json_handler) | |||||
}).insert(ignore_permissions=True) | }).insert(ignore_permissions=True) | ||||
def get_test_records(doctype): | def get_test_records(doctype): | ||||
@@ -4,7 +4,7 @@ | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
import frappe | import frappe | ||||
from frappe.utils import getdate, cint, add_months, date_diff, add_days, nowdate | |||||
from frappe.utils import getdate, cint, add_months, date_diff, add_days, nowdate, get_datetime_str | |||||
from frappe.model.document import Document | from frappe.model.document import Document | ||||
from frappe.utils.user import get_enabled_system_users | from frappe.utils.user import get_enabled_system_users | ||||
@@ -114,7 +114,11 @@ def get_events(start, end, user=None, for_reminder=False): | |||||
for e in events: | for e in events: | ||||
if e.repeat_this_event: | if e.repeat_this_event: | ||||
event_start, time_str = e.starts_on.split(" ") | |||||
e.starts_on = get_datetime_str(e.starts_on) | |||||
if e.ends_on: | |||||
e.ends_on = get_datetime_str(e.ends_on) | |||||
event_start, time_str = get_datetime_str(e.starts_on).split(" ") | |||||
if e.repeat_till == None or "": | if e.repeat_till == None or "": | ||||
repeat = "3000-01-01" | repeat = "3000-01-01" | ||||
else: | else: | ||||
@@ -4,7 +4,7 @@ | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
import frappe | import frappe | ||||
from frappe import _, msgprint | from frappe import _, msgprint | ||||
from frappe.utils import flt, cint, cstr, now | |||||
from frappe.utils import flt, cint, cstr, now, get_datetime_str | |||||
from frappe.model.base_document import BaseDocument, get_controller | from frappe.model.base_document import BaseDocument, get_controller | ||||
from frappe.model.naming import set_new_name | from frappe.model.naming import set_new_name | ||||
from werkzeug.exceptions import NotFound, Forbidden | from werkzeug.exceptions import NotFound, Forbidden | ||||
@@ -661,4 +661,4 @@ class Document(BaseDocument): | |||||
def get_signature(self): | def get_signature(self): | ||||
"""Returns signature (hash) for private URL.""" | """Returns signature (hash) for private URL.""" | ||||
return hashlib.sha224(self.creation).hexdigest() | |||||
return hashlib.sha224(get_datetime_str(self.creation)).hexdigest() |