I do not know i it is a bug or smth but if I do not use if form.process().accepted:
and just use if form.accepted: Then add_organization(form, userid) is not triggered and also if I put some prints in it I cannot see them in my PyCharm console, while, now this is interesting, e-mail is sent. Any suggestions or ideas? if request.args(0) == 'register': form = auth.register() if form.process().accepted: database = str(db).rpartition('/')[-1].replace('">', '') host = request.http_host port = request.http_port app = request.application print database, host, app if host: name = '%s/%s' % (host, app) else: name = app userid = form.vars.id email = form.vars.email first_name = form.vars.first_name last_name =form.vars.last_name org_name = form.vars.organization add_organization(form, userid) #glede na jezik se izbere formular if any("adminLanguage=sl" in s for s in request.env.HTTP_COOKIE. split(";")): formFile = os.path.join(request.folder, 'private', 'formular_WoShi_podatki.doc') else: formFile = os.path.join(request.folder, 'private', 'form_WoShi_data.doc') if not formFile or formFile is None: attachment = None else: attachment = mail.Attachment(formFile, content_id='file') #print URL(args=request.args, vars=request.get_vars, host=True) app_Url = '%s://%s' % (request.env.wsgi_url_scheme, request.env. http_host) #print app_Url regKey = db(db.auth_user.id == userid).select(db.auth_user. registration_key).first() key = regKey.registration_key message_content = T('Click on the link ') + app_Url + URL(r= request,c='default',f='user',args=['verify_email']) + '/%s ' % (key) + T('to verify your email') #print message_content mail.send(to=[email], subject='Woshi confirm registration', message=message_content, attachments = attachment ) ##dodamo še mail za i...@algit.si mail.send(to = 'somerandomem...@domain.eu', subject= 'New user registered in WoShi', message = 'A new user '+ first_name + " " + last_name +' with e-mail address ' + email +" for organization " + org_name + ' has registered to Woshi with url address ' + name + ' in database ' + database ) session.flash = T('Thank you for registering. Please check your e-mail account') redirect(URL(request.application, 'default', 'index')) return dict(form = form) On Thursday, May 11, 2017 at 8:57:24 PM UTC+2, Yebach wrote: > > OK so changing if form.process().accepted to if form.accepted works for > user registers, if I remove it from if request.args(0)=='profile': > block, it is not triggered. > As far as flash message goes the flash works after user updates profile > and everywhere else on my page but after registration it seems to hate my > code and it decided to stay hidden/none :) > > Thank you anyway > > > > > 2017-05-10 21:14 GMT+02:00 Anthony <abasta...@gmail.com>: > >> On Wednesday, May 10, 2017 at 3:14:08 AM UTC-4, Yebach wrote: >>> >>> How do you suggest I arrange my controller for user? >>> >> >> That's up to you, but for starters, maybe instead of putting all the >> logic in "if" blocks, make use of the Auth callback settings, such as >> auth.settings.register_onaccept. And for customizing the flash messages, >> use the auth.messages, such as auth.messages.registration_successful. >> >> Also, if form.process() has already been called, as in the case of the >> form object returned by auth(), you can check whether it has been accepted >> by doing: >> >> if form.accepted: >> >> You don't have to (and should not) call form.process() a second time. >> >> Anthony >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/Yfvnke6ABWM/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Lep pozdrav > > Vid Ogris > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.