示例#1
0
def mkqr(event):
    portal = api.portal.get()
    user = api.user.get_current().getProperty('email')

    execSql = SqlObj()
    execStr = "select picture_data from user_picture WHERE user = '******'" % user
    result = execSql.execSql(execStr)
    if result:
        return

    abs_url = portal.absolute_url()
    #    url = 'http://696d405b.ngrok.io/hpe/event/event_handl?email=%s' %(user)
    url = '%s/event/event_handl?email=%s' % (abs_url, user)
    qr = qrcode.QRCode()
    qr.add_data(url)
    qr.make_image().save('user.png')
    img = open('user.png', 'rb')
    b64_img = base64.b64encode(img.read())
    execStr = """INSERT INTO user_picture(user, picture_data) 
            VALUES('{}', '{}')""".format(user, b64_img)

    execSql.execSql(execStr)

    img.close()
    api.portal.show_message(message=_(
        u'Dear colleagues, please provide basic information if this is the first time you log in. Thank you'
    ),
                            request=portal.REQUEST,
                            type='info')
示例#2
0
class IBicyclePicture(Interface):
    title = schema.TextLine(
        title=_(u'Title'),
        required=True,
    )
    event = RelationChoice(
        title=_(u'Event Select'),
        source=CatalogSource(Type="EventList"),
        required=False,
    )
    place = RelationChoice(
        title=_(u'Place Select'),
        source=CatalogSource(Type="PlaceList"),
        required=False,
    )
    image = NamedBlobImage(
        title=_(u"Upload Image"),
        required=False
    )
示例#3
0
class IReservation(Interface):
    title = schema.TextLine(
        title=_(u'Title'),
        required=False
    )
    date = schema.Datetime(
        title=_(u'Reservation Date Time'),
        required=False
    )
    peroid1 = schema.TextLine(
        title=_(u'Peroid1 Reservation Name'),
        required=False,
    )
    peroid2 = schema.TextLine(
        title=_(u'Peroid2 Reservation Name'),
        required=False,
    )
    peroid3 = schema.TextLine(
        title=_(u'Peroid3 Reservation Name'),
        required=False,
    )
    peroid4 = schema.TextLine(
        title=_(u'Peroid4 Reservation Name'),
        required=False,
    )
    peroid5 = schema.TextLine(
        title=_(u'Peroid5 Reservation Name'),
        required=False,
    )
    peroid6 = schema.TextLine(
        title=_(u'Peroid6 Reservation Name'),
        required=False,
    )
    alternate = schema.Text(
        title=_(u'Alternate Name'),
        required=False,
    )
示例#4
0
class IPlaceList(Interface):
    title = schema.TextLine(
        title=_(u'Place'),
        required=True,
    )
示例#5
0
class IEventList(Interface):
    title = schema.TextLine(
        title=_(u'Event'),
        required=True,
    )