浏览代码

Merge branch 'develop'

version-14
Pratik Vyas 10 年前
父节点
当前提交
fbf3f142c0
共有 10 个文件被更改,包括 30 次插入13 次删除
  1. +1
    -1
      frappe/__version__.py
  2. +3
    -4
      frappe/core/doctype/custom_field/custom_field.py
  3. +6
    -0
      frappe/core/doctype/custom_field/test_custom_field.py
  4. +3
    -1
      frappe/database.py
  5. +1
    -1
      frappe/hooks.py
  6. +3
    -1
      frappe/model/db_schema.py
  7. +1
    -1
      frappe/public/js/frappe/views/reportview.js
  8. +5
    -0
      frappe/tests/test_db.py
  9. +6
    -3
      frappe/utils/data.py
  10. +1
    -1
      setup.py

+ 1
- 1
frappe/__version__.py 查看文件

@@ -1 +1 @@
__version__ = "4.5.8"
__version__ = "4.5.9"

+ 3
- 4
frappe/core/doctype/custom_field/custom_field.py 查看文件

@@ -9,7 +9,6 @@ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document


class CustomField(Document): class CustomField(Document):

def autoname(self): def autoname(self):
self.set_fieldname() self.set_fieldname()
self.name = self.dt + "-" + self.fieldname self.name = self.dt + "-" + self.fieldname
@@ -40,9 +39,9 @@ class CustomField(Document):
self.create_property_setter() self.create_property_setter()


# update the schema # update the schema
if not frappe.flags.in_test:
from frappe.model.db_schema import updatedb
updatedb(self.dt)
# if not frappe.flags.in_test:
from frappe.model.db_schema import updatedb
updatedb(self.dt)


def on_trash(self): def on_trash(self):
# delete property setter entries # delete property setter entries


+ 6
- 0
frappe/core/doctype/custom_field/test_custom_field.py 查看文件

@@ -1,10 +1,16 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt


from __future__ import unicode_literals

import frappe import frappe
import unittest import unittest


test_records = frappe.get_test_records('Custom Field') test_records = frappe.get_test_records('Custom Field')


from frappe.model.db_schema import InvalidColumnName

class TestCustomField(unittest.TestCase): class TestCustomField(unittest.TestCase):
pass pass

+ 3
- 1
frappe/database.py 查看文件

@@ -556,4 +556,6 @@ class Database:
self._conn = None self._conn = None


def escape(self, s): def escape(self, s):
return unicode(MySQLdb.escape_string((s or "").encode("utf-8")), "utf-8")
if isinstance(s, unicode):
s = (s or "").encode("utf-8")
return unicode(MySQLdb.escape_string(s), "utf-8")

+ 1
- 1
frappe/hooks.py 查看文件

@@ -3,7 +3,7 @@ app_title = "Frappe Framework"
app_publisher = "Web Notes Technologies Pvt. Ltd." app_publisher = "Web Notes Technologies Pvt. Ltd."
app_description = "Full Stack Web Application Framework in Python" app_description = "Full Stack Web Application Framework in Python"
app_icon = "assets/frappe/images/frappe.svg" app_icon = "assets/frappe/images/frappe.svg"
app_version = "4.5.8"
app_version = "4.5.9"
app_color = "#3498db" app_color = "#3498db"
app_email = "support@frappe.io" app_email = "support@frappe.io"




+ 3
- 1
frappe/model/db_schema.py 查看文件

@@ -13,6 +13,8 @@ import frappe
from frappe import _ from frappe import _
from frappe.utils import cstr, cint from frappe.utils import cstr, cint


class InvalidColumnName(frappe.ValidationError): pass

type_map = { type_map = {
'Currency': ('decimal', '18,6') 'Currency': ('decimal', '18,6')
,'Int': ('int', '11') ,'Int': ('int', '11')
@@ -373,7 +375,7 @@ def validate_column_name(n):
n = n.replace(' ','_').strip().lower() n = n.replace(' ','_').strip().lower()
import re import re
if re.search("[\W]", n): if re.search("[\W]", n):
frappe.throw(_("Fieldname {0} cannot contain letters, numbers or spaces").format(n))
frappe.throw(_("Fieldname {0} cannot contain letters, numbers or spaces").format(n), InvalidColumnName)
return n return n






+ 1
- 1
frappe/public/js/frappe/views/reportview.js 查看文件

@@ -197,7 +197,7 @@ frappe.views.ReportView = frappe.ui.Listing.extend({
// get table_name.column_name // get table_name.column_name
get_full_column_name: function(v) { get_full_column_name: function(v) {
if(!v) return; if(!v) return;
return (v[1] ? ('`tab' + v[1] + '`') : this.tab_name) + '.' + v[0];
return (v[1] ? ('`tab' + v[1] + '`') : this.tab_name) + '.`' + v[0] + '`';
}, },


// build columns for slickgrid // build columns for slickgrid


+ 5
- 0
frappe/tests/test_db.py 查看文件

@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt # MIT License. See license.txt


@@ -14,3 +16,6 @@ class TestDB(unittest.TestCase):
self.assertEquals(frappe.db.get_value("User", {"name": ["<=", "Administrator"]}), "Administrator") self.assertEquals(frappe.db.get_value("User", {"name": ["<=", "Administrator"]}), "Administrator")
self.assertEquals("test1@example.com", frappe.db.get_value("User", {"name": [">", "s"]})) self.assertEquals("test1@example.com", frappe.db.get_value("User", {"name": [">", "s"]}))
self.assertEquals("test1@example.com", frappe.db.get_value("User", {"name": [">=", "t"]})) self.assertEquals("test1@example.com", frappe.db.get_value("User", {"name": [">=", "t"]}))

def test_escape(self):
frappe.db.escape("香港濟生堂製藥有限公司 - IT".encode("utf-8"))

+ 6
- 3
frappe/utils/data.py 查看文件

@@ -165,9 +165,12 @@ def formatdate(string_date=None, format_string=None):


out = frappe.local.user_format or "yyyy-mm-dd" out = frappe.local.user_format or "yyyy-mm-dd"


return out.replace("dd", date.strftime("%d"))\
.replace("mm", date.strftime("%m"))\
.replace("yyyy", date.strftime("%Y"))
try:
return out.replace("dd", date.strftime("%d"))\
.replace("mm", date.strftime("%m"))\
.replace("yyyy", date.strftime("%Y"))
except ValueError, e:
raise frappe.ValidationError, str(e)


def global_date_format(date): def global_date_format(date):
"""returns date as 1 January 2012""" """returns date as 1 January 2012"""


+ 1
- 1
setup.py 查看文件

@@ -1,7 +1,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
import os import os


version = "4.5.8"
version = "4.5.9"


with open("requirements.txt", "r") as f: with open("requirements.txt", "r") as f:
install_requires = f.readlines() install_requires = f.readlines()


正在加载...
取消
保存