diff --git a/fields/ref.py b/fields/ref.py index 1678e8c..f94dec6 100644 --- a/fields/ref.py +++ b/fields/ref.py @@ -151,7 +151,7 @@ class Ref(Field): 'askConfirm(%s,%s,%s)' % (q('script'), q(formCall), \ q(addConfirmMsg)); noFormCall=navBaseCall.replace('**v**', \ - '%d,%s' % (startNumber, q('CreateWithoutForm'))); + '%d,%s' % (startNumber, q('doCreateWithoutForm'))); noFormCall=not field.addConfirm and noFormCall or \ 'askConfirm(%s, %s, %s)' % (q('script'), q(noFormCall), \ q(addConfirmMsg)); @@ -341,10 +341,10 @@ class Ref(Field): ''') - # Simplified widget showing comma-separated not-clickable object titles. - pxViewTitles = Px(''':', '.join(titles) or \ - _('no_ref')''') + # Simplified widget showing minimal info about tied objects. + pxViewMinimal = Px(''' + :', '.join(infos) or _('no_ref')''') # PX that displays referred objects through this field. In mode link="list", # if, in the request, key "scope" is present and holds value "objs", the @@ -383,7 +383,7 @@ class Ref(Field): checkboxes=checkboxesEnabled and (totalNumber > 1); showSubTitles=req.get('showSubTitles', 'true') == 'true'"> -
:field.pxViewList
:field.pxViewList - :getattr(field, 'pxView%s' % \ + :getattr(field, 'pxView%s' % \ render.capitalize()) ''') @@ -562,8 +562,8 @@ class Ref(Field): # Indeed, we need to keep the "list" rendering in the "view" layout # because the "menus" rendering is minimalist and does not allow to # perform all operations on linked objects (add, move, delete, edit...); - # - "titles" renders a list of comma-separated, not-even-clickable, - # titles. + # - "minimal" renders a list of comma-separated, not-even-clickable, + # data about the tied objects (according to shownInfo). self.render = render # If render is 'menus', 2 methods must be provided. # "menuIdMethod" will be called, with every linked object as single arg, @@ -1004,6 +1004,11 @@ class Ref(Field): uids.remove(uid) uids.insert(newIndex, uid) + def doCreateWithoutForm(self, obj): + '''This method is called when a user wants to create a object from a + reference field, automatically (without displaying a form).''' + obj.appy().create(self.name) + xhtmlToText = re.compile('<.*?>', re.S) def getReferenceLabel(self, refObject, unlimited=False): '''p_self must have link=True. I need to display, on an edit view, the diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index b1ecf1d..8d47a1a 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -419,7 +419,7 @@ class ToolMixin(BaseMixin): def quote(self, s): '''Returns the quoted version of p_s.''' if not isinstance(s, basestring): s = str(s) - s = s.replace('\r\n', '').replace('\n', '').replace("'", "\\'") + s = s.replace('\r\n', '').replace('\n', '').replace("'", "'") return "'%s'" % s def getLayoutType(self): @@ -962,7 +962,7 @@ class ToolMixin(BaseMixin): # c. Identify the user from the authentication form. if not login: login = req.get('__ac_name', None) - password = req.get('__ac_password', None) + password = req.get('__ac_password', '') # Stop identification here if we don't need to return a special user if not alsoSpecial: return login, password # d. All the identification methods failed. So identify the user as diff --git a/gen/mixins/__init__.py b/gen/mixins/__init__.py index e136851..092ddd5 100644 --- a/gen/mixins/__init__.py +++ b/gen/mixins/__init__.py @@ -324,12 +324,6 @@ class BaseMixin: self.say(self.translate('action_done')) self.goto(urlBack) - def onCreateWithoutForm(self): - '''This method is called when a user wants to create a object from a - reference field, automatically (without displaying a form).''' - rq = self.REQUEST - self.appy().create(rq['fieldName']) - def intraFieldValidation(self, errors, values): '''This method performs field-specific validation for every field from the page that is being created or edited. For every field whose diff --git a/gen/wrappers/UserWrapper.py b/gen/wrappers/UserWrapper.py index 0e30d4e..0ba3e1c 100644 --- a/gen/wrappers/UserWrapper.py +++ b/gen/wrappers/UserWrapper.py @@ -74,7 +74,7 @@ class UserWrapper(AbstractWrapper): '''Sets a p_newPassword for self. If p_newPassword is not given, we generate one. This method returns the generated password (or simply p_newPassword if no generation occurred).''' - if newPassword: + if newPassword != None: msgPart = 'changed' else: newPassword = self.getField('password1').generatePassword()