# HG changeset patch # User Surkov Sergey # Date 1519056145 -10800 # Node ID b524b356aa58cb922eb0a023f6a08d718812b6dc # Parent 0607c382d73f7af53cec12583567ababe163ba61 add address validation in Company URL field diff -r 0607c382d73f -r b524b356aa58 controls/ProjectPropertiesPanel.py --- a/controls/ProjectPropertiesPanel.py Fri Feb 02 17:16:04 2018 +0300 +++ b/controls/ProjectPropertiesPanel.py Mon Feb 19 19:02:25 2018 +0300 @@ -26,6 +26,8 @@ from __future__ import absolute_import import wx +from xmlclass.xmlclass import URI_model + # ------------------------------------------------------------------------------- # Helpers # ------------------------------------------------------------------------------- @@ -285,6 +287,14 @@ new_value = textctrl.GetValue() if name not in REQUIRED_PARAMS and new_value == "": new_value = None + if name == 'companyURL': + if not URI_model.match(new_value): + new_value = None + dialog = wx.MessageDialog(self, _('Invalid URL!\n' + 'Please enter correct URL address.'), + _("Error"), wx.OK | wx.ICON_ERROR) + dialog.ShowModal() + dialog.Destroy() if old_value != new_value: self.Controller.SetProjectProperties(properties={name: new_value}) self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU,