[web2py] Re: How can I return file name after inserting?

2019-02-27 Thread Константин Комков
четверг, 28 февраля 2019 г., 0:57:03 UTC+3 пользователь Dave S написал:
>
> Why not?
>
I think when we insert something in table we already know server-side 
filename. Also in firebird there is 'RETURNING' for that case.
Yes, I use upload field.

db_app.define_table('doc_images',
 Field ('file', 'upload', 
requires=[IS_UPLOAD_FILENAME 
(extension='^(pdf|tiff|png|bmp|jpeg|jpg)$'),IS_LENGTH
 (10485760, 1024)]),
 format = '%(title)s')

-- 
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.


[web2py] Installing web2py behind IIS (for Massimo Di Pierro)

2019-02-27 Thread Константин Комков
Massimo Di Pierro, hello. Help me please install web2py behind IIS. 
Instruction in book don't work. I have old projects and one new. Old 
projects work, new project open only index page and after ajax call 
redirect to welcome page. I can not find solution here 
.

-- 
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.


[web2py] dict values error in python 3.6

2019-02-27 Thread Maurice Waka
Hallo,
While creating a db, 
def create():
form = SQLFORM(db.food_data,submit_button=T('Submit'))
form.element('input[value=Submit]')['_style']='background-color: 
#DA2128; color:#ff'
if form.process().accepted:
 response.flash="form accepted"
 redirect(URL('default', 'searching'))
return dict(form=form)



Trying to enter data, I got this error:

Traceback (most recent call last):
 File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in restricted
 exec(ccode, environment)
 File "/home/mauricewaka/web2py/applications/HWell/views/generic.html" 
, 
line 81, in 
TypeError: 'dict_values' object does not support i

ndexing

-- 
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.


Re: [web2py] Javascript return value

2019-02-27 Thread Val K

here is scaffold

view script:

$(function(){
var url  = '{{=URL()}}';
function onvalidate (d) {
if d.company_list {
// do popup here using d.company_list


//finally post user choice (that is stored in the 
`company` variable)
  $.post(url, {'company': company}
 ); 
}
else{
   // login failed - do error-popup 
};

};
function onsubmit(){
   // grab 'user' and 'password' values and 
send it to `url` via ajax, response will be processed by `onvalidate` 
function
   ajax(url, ['user', 'password'], null , 
{success: onvalidate});
return false; // this prevents the page reloading
};
// intercept form submission
$('form').submit(onsubmit);
});


controller.py:

def login():
if request.ajax:
if session.user and request.vars.company:
#validate request.vars.company
if company_is_valid:
session.company = request.vars.company
# do login using session.user
redirect(URL(...), client_side = True)
else:
#user is playing with browser console:)
return None
elif request.vars.user:
user = request.vars.user
password = request.vars.password
# do validatoin
if is_valid:
session.user = user
return response.json(dict(company_list = ...))
else:
#validation fail
return None # or somthing like response.json(dict(error = 
'invalid login'))
else:
return SQLFORM.factory(...).process()










On Wednesday, February 27, 2019 at 8:29:51 PM UTC+3, Ben Duncan wrote:
>
> Ok  a little more detail in  pseudo code:
>
> Display Login page:
> get user name and password.
> If form validates:
>validate username and password
>if username and password validates
>   popup company selection
>   get company 
>   redirect to next page
>else
>   show "username password" error message
>   go back Display Login page: 
> else  # Forms did not pass validation ...
>   go back Display Login page: 
>
> That's the flow I'm used to using in CS software ...
>
> Thanks ...
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Wed, Feb 27, 2019 at 6:53 AM Ben Duncan  > wrote:
>
>> What I was hoping to do was a javascript popup to to choose a company, 
>> then a redirect.
>> I load the company number and values in a session variables upon 
>> connection.
>>
>> The user id file can have a default company (court) assignment , in which 
>> case there would be no reason to do the popup, but
>> if the user had '0' in the company or was a super admin, it would do the 
>> popup for company (Court)
>>
>> Make sense ?
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect 
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Wed, Feb 27, 2019 at 2:51 AM Val K > 
>> wrote:
>>
>>> Hard to understand the workflow, do you want the user to be redirected 
>>> to choose the company after he has logged in? or he should make a choice 
>>> along the login form filling?
>>>
>>> -- 
>>> 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+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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.


[web2py] Re: How can I return file name after inserting?

2019-02-27 Thread Dave S
On Wednesday, February 27, 2019 at 3:19:47 AM UTC-8, Константин Комков 
wrote:
>
> I want to get it - 
> 'doc_images.file.bf573aec8fdf573f.666c6f7765722e6a706567.jpeg'. I want to 
> get it after my file was in uploads folder. I don't use SQLFORM. Are there 
> any way to get not only id after inserting?
> I don't want make
>

Why not?
 

> something like it:
>
>> k = db_app.doc_images.insert(file=request.vars.files[i])
>> filename = db_app(db_app.doc_images.id == 
>> k).select(db_app.doc_images.file)
>> db.a_files.insert(ID_REQUEST=requestId,FILE_NAME=filename) 
>
>
I take it you're trying to pass the server-side filename around, as you've 
used an upload field with the features descibed under "Field Constructor" 
in Chapter 6?

/dps
 

-- 
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.


[web2py] Re: form in modal

2019-02-27 Thread Leonel Câmara
I use this little javascript function

function load_in_modal(url, modal_id, options, modal_options) {
if (typeof options === 'undefined') {
  /* Example Options.
   * {title: "Add Image"}
   */
  options = {};
}
if (typeof modal_options === 'undefined') {
  modal_options = {}
}
modal_options.show = true;

/* Remember to set an id in your modal's body */
$.web2py.component(url, $('#' + modal_id + ' .modal-body').attr('id'));

$('#' + modal_id).modal(modal_options);
if (typeof options.title !== undefined) {
$('#' + modal_id + ' .modal-title').text(options.title);
}
}


Usage in your case would be to remove the LOAD call and change the button 
to this:



News


-- 
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.


[web2py] Re: Web2py freezes when inserting rows. Problem seems to be database connection limit per application.

2019-02-27 Thread Leonel Câmara
If you're inserting a lot of rows you should probably be using the 
scheduler. That said you don't have a harakiri config so it's probably a 
timeout in your nginx config.

-- 
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.


[web2py] Web2py freezes when inserting rows. Problem seems to be database connection limit per application.

2019-02-27 Thread William
Hi all, my application has a tendency to freeze whenever I run a process 
that inserts row to the database. Does anyone know how to fix this?

I'm currently deploying Web2py on DigitalOcean using nginx + uwsgi and 
MySQL database. My uwsgi has the following settings:

chdir = WEB2PY_PATH_PLACEHOLDER/WEB2PY_APP_PLACEHOLDER
> module = wsgihandler:application 

master = true
> *processes = 5*


> uid = USERNAME_PLACEHOLDER
> socket = /run/uwsgi/WEB2PY_APP_PLACEHOLDER.sock
> chown-socket = USERNAME_PLACEHOLDER:nginx
> chmod-socket = 660
> vacuum = true


I have also tried setting DAL pool_size = 10 but to no avail. 

However I have found a temporary fix by creating a new application to 
access the same database. If I insert rows using the second application, 
the first application no longer freezes up. 

Hence I believe there's some kind of connection limit per application that 
is causing my app to hang whenever I insert rows. How can I fix it?

-- 
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.


[web2py] form in modal

2019-02-27 Thread Shawn Michaels
Hi, I managed to get form in modal to work, but I have problem - when I 
submit form the form hides and there is still shadow background there. I'm 
working with latest bootstrap (4.3.1) right now (don't know if it's the 
reason).

response.js with form.errors shows the form again but with accepted it's 
unable to hide. I suppose it should work without response.js at all but 
without it the form hides but as I stated before there is still shadow 
background over page.

def news():
form = SQLFORM.factory(
Field('your_name', requires=IS_NOT_EMPTY()),
Field('your_state',))

if form.process().accepted:
response.js = '(function($) {$("#news").modal("hide");}(jQuery));'
response.flash = 'form accepted'
elif form.errors:
response.js = '(function($) {$("#news").modal("show");}(jQuery));'
response.flash = 'form has errors'
else:
#response.js = target_response
response.flash = 'please fill the form'
return dict(form=form)



  News


  

  
News

  ×

  
  
{{=form}}
  

  



{{extend 'layout.html'}}
{{=LOAD('default', 'news.load', ajax=True)}}

Is it possible to get forms in modal to work? If so, how, thanks.

-- 
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.


Re: [web2py] another python 3 minor bug in 2.18.2: b'Logged in'

2019-02-27 Thread 黄祥
already created
https://github.com/web2py/web2py/issues/2110

best regards,
stifan

-- 
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.


Re: [web2py] Javascript return value

2019-02-27 Thread Ben Duncan
Ok  a little more detail in  pseudo code:

Display Login page:
get user name and password.
If form validates:
   validate username and password
   if username and password validates
  popup company selection
  get company
  redirect to next page
   else
  show "username password" error message
  go back Display Login page:
else  # Forms did not pass validation ...
  go back Display Login page:

That's the flow I'm used to using in CS software ...

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Feb 27, 2019 at 6:53 AM Ben Duncan  wrote:

> What I was hoping to do was a javascript popup to to choose a company,
> then a redirect.
> I load the company number and values in a session variables upon
> connection.
>
> The user id file can have a default company (court) assignment , in which
> case there would be no reason to do the popup, but
> if the user had '0' in the company or was a super admin, it would do the
> popup for company (Court)
>
> Make sense ?
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Wed, Feb 27, 2019 at 2:51 AM Val K  wrote:
>
>> Hard to understand the workflow, do you want the user to be redirected to
>> choose the company after he has logged in? or he should make a choice along
>> the login form filling?
>>
>> --
>> 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.
>>
>

-- 
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.


Re: [web2py] another python 3 minor bug in 2.18.2: b'Logged in'

2019-02-27 Thread Kevin Keller
Could you open a ticket on github please with some supporting info.



On Wed, 27 Feb 2019, 12:32 黄祥,  wrote:

> similar issues happen during :
> - clear session, cache from web2py admin
> - remove app from web2py admin
>
> best regards,
> stifan
>
> --
> 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.
>

-- 
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.


Re: [web2py] Javascript return value

2019-02-27 Thread Ben Duncan
What I was hoping to do was a javascript popup to to choose a company, then
a redirect.
I load the company number and values in a session variables upon connection.

The user id file can have a default company (court) assignment , in which
case there would be no reason to do the popup, but
if the user had '0' in the company or was a super admin, it would do the
popup for company (Court)

Make sense ?

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Feb 27, 2019 at 2:51 AM Val K  wrote:

> Hard to understand the workflow, do you want the user to be redirected to
> choose the company after he has logged in? or he should make a choice along
> the login form filling?
>
> --
> 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.
>

-- 
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.


Re: [web2py] Re: Using Http.Client module in my controls

2019-02-27 Thread elisha bere
How do i fix that? Http.client is not my module. How do i implement so this
code can work??

On 27 Feb 2019 14:35, "黄祥"  wrote:

> seems can't found the module applications/welcome/modules/http.py
>
> best regards,
> stifan
>
> --
> 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.
>

-- 
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.


Re: [web2py] Re: Using Http.Client module in my controls

2019-02-27 Thread 黄祥
seems can't found the module applications/welcome/modules/http.py

best regards,
stifan

-- 
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.


Re: [web2py] another python 3 minor bug in 2.18.2: b'Logged in'

2019-02-27 Thread 黄祥
similar issues happen during :
- clear session, cache from web2py admin
- remove app from web2py admin

best regards,
stifan

-- 
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.


Re: [web2py] Re: 2.18.1 is OUT

2019-02-27 Thread 黄祥
done
ref:
https://github.com/web2py/web2py/issues/2108

best regards,
stifan

-- 
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.


Re: [web2py] Re: Problem updating list stored in session

2019-02-27 Thread Jon Subscripted
Hi everyone,
I keep on looking for the problem in order to avoid disgusting surprises in
the near future.

Is there any size limitation in session storage object?
Thanks in advance.
Regards, Jon.

On Wed, Feb 27, 2019 at 12:57 PM Jon Subscripted 
wrote:

> Thanks Leonel,
> Yes, as you comment the assignation was correct.
>
> I managed to fix it but I do not know why yet. It must be something else,
> somewhere else in the controller code (that's my guess).
>
> I went for the following quick and dirty test and it started to work:
>
> 1) duplicate the variables stored in the session, see below:
>
> if session.training_id is None:
> session.training_id = 0
> session.user_training_probs = []
> session.configuration_training = 0 #REMOVE: for debuggin only
> session.configuration_list = []#REMOVE: for debuggin only
>
> session.training_id = training_id
> session.user_training_probs = list(set([r.problem  for r in rows]))#remove
> duplicates
> session.configuration_training = training_id#REMOVE: for debuggin only
> session.configuration_list = list(set([r.problem  for r in
> rows]))#REMOVE: for debuggin only
>
> 2) check that the new ones were correctly updated
> 3) replace the session variables used in views and controllers ( from
> training_id and user_training_probs to configuration_training and
> configuration_list)
>
> I'll keep on seeking for the problem.
> Regards, Jon.
>
>
> On Wed, Feb 27, 2019 at 10:10 AM Leonel Câmara 
> wrote:
>
>> I don't see anything wrong with your code, you're even creating new lists
>> each time you change the value so they're surely being updated. If the view
>> is showing correctly, maybe the problem is with your debug code which is
>> printing session values before they're changed.
>>
>> --
>> 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.
>>
>

-- 
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.


Re: [web2py] Re: Problem updating list stored in session

2019-02-27 Thread Jon Subscripted
Thanks Leonel,
Yes, as you comment the assignation was correct.

I managed to fix it but I do not know why yet. It must be something else,
somewhere else in the controller code (that's my guess).

I went for the following quick and dirty test and it started to work:

1) duplicate the variables stored in the session, see below:

if session.training_id is None:
session.training_id = 0
session.user_training_probs = []
session.configuration_training = 0 #REMOVE: for debuggin only
session.configuration_list = []#REMOVE: for debuggin only

session.training_id = training_id
session.user_training_probs = list(set([r.problem  for r in rows]))#remove
duplicates
session.configuration_training = training_id#REMOVE: for debuggin only
session.configuration_list = list(set([r.problem  for r in
rows]))#REMOVE: for debuggin only

2) check that the new ones were correctly updated
3) replace the session variables used in views and controllers ( from
training_id and user_training_probs to configuration_training and
configuration_list)

I'll keep on seeking for the problem.
Regards, Jon.


On Wed, Feb 27, 2019 at 10:10 AM Leonel Câmara 
wrote:

> I don't see anything wrong with your code, you're even creating new lists
> each time you change the value so they're surely being updated. If the view
> is showing correctly, maybe the problem is with your debug code which is
> printing session values before they're changed.
>
> --
> 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.
>

-- 
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.


[web2py] Re: How can I return file name after inserting?

2019-02-27 Thread Константин Комков
I want to get it - 
'doc_images.file.bf573aec8fdf573f.666c6f7765722e6a706567.jpeg'. I want to 
get it after my file was in uploads folder. I don't use SQLFORM. Are there 
any way to get not only id after inserting?

-- 
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.


Re: [web2py] Re: 2.18.1 is OUT

2019-02-27 Thread Kevin Keller
Can you file an issue on github please?

On Wed, 27 Feb 2019, 09:26 黄祥,  wrote:

> Traceback (most recent call last):
>>   File "/Users/sugizo/project/python/web2py/gluon/restricted.py", line
>> 219, in restricted
>> exec(ccode, environment)
>>   File
>> "/Users/sugizo/project/python/web2py/applications/test/models/db_schema_0_auth.py",
>> line 9, in 
>> custom_auth_table = db[auth.settings.table_user_name]
>>   File
>> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/base.py",
>> line 666, in __getitem__
>> return self.__getattr__(str(key))
>>   File
>> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/base.py",
>> line 672, in __getattr__
>> return self.lazy_define_table(tablename, *fields, **kwargs)
>>   File
>> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/base.py",
>> line 624, in lazy_define_table
>> polymodel=polymodel)
>>   File
>> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/adapters/base.py",
>> line 798, in create_table
>> return self.migrator.create_table(*args, **kwargs)
>>   File
>> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/migrator.py",
>> line 279, in create_table
>> query), table)
>>   File
>> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/migrator.py",
>> line 488, in log
>> logfile.write(to_bytes(message))
>>   File
>> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/helpers/classes.py",
>> line 544, in write
>> self.data += data
>> TypeError: can only concatenate str (not "bytes") to str
>>
>
> found the culprit :
> *models/db.py*
> adapter_args = dict(migrator = InDBMigrator)
>
> when comment it out the traceback error disappear not sure if migrator =
> InDBMigrator broken in new version
> everything start from scratch (default welcome boostrap)
>
> best regards,
> stifan
>
> --
> 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.
>

-- 
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.


Re: [web2py] Web2py Windows edition with 3.x Interpreter

2019-02-27 Thread Nico Zanferrari
Hi,

this is a big problem also from my point of view and I've already opened issue
2027  . However it's not so
easy to achieve this goal, because you've to switch to 3.x + go 64 bit +
change the *freezer* program (py2exe and bbfreeze do not work with python
>= 3.5). I'm playing with pyinstaller, but I'm not promising anything. And
also a binary Mac version is needed (I only have a Win box), plus testing
everything.

Cheers,
Nico

Il giorno mer 27 feb 2019 alle ore 11:45 elisha bere 
ha scritto:

> Hie,
>
> Is it possible to change from 2.7 to 3.x in my web2py app
>
> On 17 Feb 2019 20:57, "Jitun John"  wrote:
>
>> "It requires Python 2.6 (no more supported), Python 2.7 (stable) or
>> Python 3.5+ (*recommended for new projects*) already installed on your
>> system.
>> There are also *binary packages for Windows* and Mac OS X.* They include
>> the Python 2.7 interpreter* so you do not need to have it pre-installed."
>>
>> Sorry for my ignorance, I am assuming "Python 2.7 interpreter" as
>> "python27.dll" and "pywintypes27.dll" files.
>>
>> I recently moved my app from 2.x to 3.x using PyCharm IDE and the app
>> works fine when using IDE on 3.7 python.
>> But when I try to compile it to .exe (using .iss file + hstart.exe), I
>> cant use the existing web2py_win.zip file.
>>
>> Gives me " unsupported pickle protocol: 3"
>>
>> As we are recommending new projects on 3.x, Is it possible for the next
>> version to have a 3.x interpreter ?
>> or if we have a workaround, I am happy to try it.
>>
>> Thanks.
>>
>> --
>> 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.
>>
> --
> 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.
>

-- 
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.


Re: [web2py] another python 3 minor bug in 2.18.2: b'Logged in'

2019-02-27 Thread Kevin Keller
Can you file an issue on github please?

On Tue, 26 Feb 2019, 20:36 Yi Liu,  wrote:

> b'Logged In' in flash message:
>
> [image: Screen Shot 2019-02-26 at 12.33.29.png]
> This is in auth, not something in my app, right?
>
> --
> 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.
>

-- 
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.


Re: [web2py] Re: Using Http.Client module in my controls

2019-02-27 Thread elisha bere
import http.client


def send():
conn = http.client.HTTPConnection("api.msg91.com")
msg = " This is the test message i want to send though later it
will be changed"
my_list = msg.split()
final_text = "%20".join(my_list)

conn = http.client.HTTPConnection("api.msg91.com")

conn.request("GET",
"/api/sendhttp.php?sender=ELISHA&route=4&mobiles=MOBILENUMBER&authkey=API
AUTH KEY&encrypt=&country=263&message={}".format(final_text))

res = conn.getresponse()
data = res.read()

data.decode("utf-8")
The above is my control. so when i run the related view i get error below:

Traceback (most recent call last):
  File "D:\web2py apps\web2py_win\web2py\gluon\restricted.py", line
219, in restricted
exec(ccode, environment)
  File "D:/web2py
apps/web2py_win/web2py/applications/welcome/controllers/default.py",
line 8, in 
import http.client
  File "D:\web2py apps\web2py_win\web2py\gluon\custom_import.py", line
104, in custom_importer
raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ImportError("Cannot import module
'applications.welcome.modules.http'",), )



On 27/02/2019, 黄祥  wrote:
> perhaps you can share the code that reproduce an error and the traceback
> error log
>
> best regards,
> stifan
>
> --
> 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.
>

-- 
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.


Re: [web2py] How can I return file name after inserting?

2019-02-27 Thread sandeep patel
If you are using the form to summiting data. You can use form vars to
summiting data into multiple tables.
form = SQLFORM(...)
if form.process().accepted:
db['table name'].insert(**form.vars)

Even you only want to insert a specific field to the table you can do so.
db.['table name'].insert(filename = form.vars.filename)


Thanks
SP

On Wed, Feb 27, 2019 at 4:03 PM Константин Комков 
wrote:

> I insert file in table and then I want to write its name in another table.
> How can I return filename?
>>
>> >>> db_app.doc_images.insert(file=request.vars.files[i])
>> 1 (I got id)
>
>
>
>
> --
> 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.
>

-- 
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.


Re: [web2py] Web2py Windows edition with 3.x Interpreter

2019-02-27 Thread elisha bere
Hie,

Is it possible to change from 2.7 to 3.x in my web2py app

On 17 Feb 2019 20:57, "Jitun John"  wrote:

> "It requires Python 2.6 (no more supported), Python 2.7 (stable) or
> Python 3.5+ (*recommended for new projects*) already installed on your
> system.
> There are also *binary packages for Windows* and Mac OS X.* They include
> the Python 2.7 interpreter* so you do not need to have it pre-installed."
>
> Sorry for my ignorance, I am assuming "Python 2.7 interpreter" as
> "python27.dll" and "pywintypes27.dll" files.
>
> I recently moved my app from 2.x to 3.x using PyCharm IDE and the app
> works fine when using IDE on 3.7 python.
> But when I try to compile it to .exe (using .iss file + hstart.exe), I
> cant use the existing web2py_win.zip file.
>
> Gives me " unsupported pickle protocol: 3"
>
> As we are recommending new projects on 3.x, Is it possible for the next
> version to have a 3.x interpreter ?
> or if we have a workaround, I am happy to try it.
>
> Thanks.
>
> --
> 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.
>

-- 
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.


[web2py] How can I return file name after inserting?

2019-02-27 Thread Константин Комков
I insert file in table and then I want to write its name in another table. 
How can I return filename?
>
> >>> db_app.doc_images.insert(file=request.vars.files[i])
> 1 (I got id)


 

-- 
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.


[web2py] Re: Web2py Windows edition with 3.x Interpreter

2019-02-27 Thread Jitun John
Fixed the pickle issue by deleting "databases" folder in the app.

Wondering if we will ever (if it is possible) to get a 3.x python version 
of web2py windows  ("python37.dll" and "pywintypes37.dll" files.)

-- 
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.


[web2py] Re: 2.18.1 is OUT

2019-02-27 Thread 黄祥

>
> Traceback (most recent call last):
>   File "/Users/sugizo/project/python/web2py/gluon/restricted.py", line 
> 219, in restricted
> exec(ccode, environment)
>   File 
> "/Users/sugizo/project/python/web2py/applications/test/models/db_schema_0_auth.py",
>  
> line 9, in 
> custom_auth_table = db[auth.settings.table_user_name]
>   File 
> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/base.py", 
> line 666, in __getitem__
> return self.__getattr__(str(key))
>   File 
> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/base.py", 
> line 672, in __getattr__
> return self.lazy_define_table(tablename, *fields, **kwargs)
>   File 
> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/base.py", 
> line 624, in lazy_define_table
> polymodel=polymodel)
>   File 
> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/adapters/base.py",
>  
> line 798, in create_table
> return self.migrator.create_table(*args, **kwargs)
>   File 
> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/migrator.py", 
> line 279, in create_table
> query), table)
>   File 
> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/migrator.py", 
> line 488, in log
> logfile.write(to_bytes(message))
>   File 
> "/Users/sugizo/project/python/web2py/gluon/packages/dal/pydal/helpers/classes.py",
>  
> line 544, in write
> self.data += data
> TypeError: can only concatenate str (not "bytes") to str
>

found the culprit :
*models/db.py*
adapter_args = dict(migrator = InDBMigrator)

when comment it out the traceback error disappear not sure if migrator = 
InDBMigrator broken in new version
everything start from scratch (default welcome boostrap)

best regards,
stifan

-- 
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.


[web2py] Re: Problem updating list stored in session

2019-02-27 Thread Leonel Câmara
I don't see anything wrong with your code, you're even creating new lists 
each time you change the value so they're surely being updated. If the view 
is showing correctly, maybe the problem is with your debug code which is 
printing session values before they're changed.

-- 
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.


[web2py] Re: Using Http.Client module in my controls

2019-02-27 Thread 黄祥
perhaps you can share the code that reproduce an error and the traceback 
error log

best regards,
stifan

-- 
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.


[web2py] Javascript return value

2019-02-27 Thread Val K
Hard to understand the workflow, do you want the user to be redirected to 
choose the company after he has logged in? or he should make a choice along the 
login form filling?

-- 
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.


[web2py] Re: Get files from string

2019-02-27 Thread Константин Комков
Leonel Câmara, thank you! In controller:

> i = 0
> while i < len(request.vars.files):
> db_app.doc_images.insert(file=request.vars.files[i])
> i += 1

-- 
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.