Esempio n. 1
0
def transaction_feeIsValid(value):
    """
    """
    if(value):
        try:
            value = float(value)
            if value<0:
                raise Invalid(_(u'Transaction fee to small. Fee must be less than greater than 0.'))
        except:
            raise Invalid(_(u'The transaction_fee must be numeric'))
    return True
Esempio n. 2
0
def discountIsValid(value):
    """
    """
    if(value):
        try:
            value = float(value)
            if value>100:
                raise Invalid(_(u'Discount to large. Discount must be less than 100 and greater than 0.'))
            if value<0:
                raise Invalid(_(u'Discount to small. Discount must be less than 100 and greater than 0.'))
        except:
            raise Invalid(_(u'The discount must be numeric'))
    return True
Esempio n. 3
0
def is_url(value):
    """Is this a URL?
    """
    if isinstance(value, basestring):
        pattern = re.compile(r"^https?://[^\s\r\n]+")
        if pattern.search(value.strip()):
            return True
    raise Invalid(_(u"Ogiltig länk"))
Esempio n. 4
0
def corporateIdIsValid(value):
    """Constraint function to make sure a given corporateId is corporateIdIsValid
	   TODO: Check the number to ensure the corretct format also
	"""
    if value:
        if len(value) != 10:
            raise Invalid(_(u'The corporateId must be 10 digits'))
    return True
Esempio n. 5
0
def is_email(value):
    """Is this an email address?
    """
    if not isinstance(value, basestring) or not '@' in value:
        raise Invalid(_(u"Ogiltig epostadress"))
    return True
Esempio n. 6
0
                workflowTool.doActionFor(self.__parent__, 'abort', comment='')
            except WorkflowException, ex:
                print "Could not apply workflow transition 'abort'.", self.__parent__.UID(), "with foreign_id", self.__parent__.foreign_id,"state not changed.", ex

            if self._BrowserView__getParent().__parent__.Type() == 'Person':
                return_view = 'my-person'
            else:
                return_view = 'my-clubs'

            self.redirect(self.url(return_view))
        else:
            self.title = uuidToObject(self.context.foreign_id).Title()
            if self.__parent__.__parent__.Type() == 'Person':
                self.remove_from = self.__parent__.__parent__.first_name + ' ' + self.__parent__.__parent__.last_name
            else:
                self.remove_from = _(u'dig själv')

# temp view for reindexing brains
from Products.CMFCore.interfaces import ISiteRoot
class ReindexBrains(grok.View):
    grok.context(ISiteRoot)
    grok.require('zope2.View')
    grok.name('reindexbrains')

    def render(self):

        interface = self.request.form.get('if') or None

        catalog = getToolByName(self.context, 'portal_catalog')

        query_dict = {}
Esempio n. 7
0
def districtIdIsValid(value):
    # Verify uniqueness, please...
    if value:
        if 1 == 2:
            raise Invalid(_(u'The districtId is invalid'))
    return True