[note] [fix] strip invalid characters from title and set it as the name of the note
This commit is contained in:
parent
d9384c0583
commit
5dfba486a6
@ -2,6 +2,8 @@ import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("utilities", "doctype", "note")
|
||||
webnotes.reload_doc("utilities", "doctype", "note_user")
|
||||
|
||||
for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
|
||||
name = question.question[:180]
|
||||
if webnotes.conn.exists("Note", name):
|
||||
|
@ -7,6 +7,11 @@ class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def autoname(self):
|
||||
# replace forbidden characters
|
||||
import re
|
||||
self.doc.name = re.sub("[%'\"#*?`]", "", self.doc.title.strip())
|
||||
|
||||
def onload(self):
|
||||
if not self.doc.public and webnotes.session.user != self.doc.owner:
|
||||
if webnotes.session.user not in [d.user for d in self.doclist if d.doctype=="Note User"]:
|
||||
|
@ -2,14 +2,13 @@
|
||||
{
|
||||
"creation": "2013-05-24 13:41:00",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-24 16:47:19",
|
||||
"modified": "2013-05-27 12:16:46",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_print": 0,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:title",
|
||||
"description": "Note is a free page where users can share documents / notes",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Transaction",
|
||||
|
Loading…
x
Reference in New Issue
Block a user