'Image form validation'

@staticmethod
def pr_image_onvalidation(form):

    form_vars = form.vars
    image = form_vars.image
    url = form_vars.url
    if (not hasattr(image, 'file')):
        id = current.request.post_vars.id
        if id:
            db = current.db
            table = db.pr_image
            record = db((table.id == id)).select(table.image, limitby=(0, 1)).first()
            if record:
                image = record.image
    if ((not hasattr(image, 'file')) and (not image) and (not url)):
        form.errors.image = form.errors.url = current.T('Either    file    upload    or    image    URL    required.')
