[web2py] Get files from string

2019-02-26 Thread Константин Комков
I send ajax request using FormData with variable which contains js array 
with files. In python function I can get this variable, but it contain 
string like that:
>
> request.vars.files = '[object File],[object File],[object File]'

How can I get files from that string?

-- 
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] auth.settings user_url

2019-02-26 Thread 'Annet' via web2py-users
I have one application that takes car of all the auth stuff. 
In the init application I have a couple of functions that require login,.

I added this line of code session.connect(request, response, 
masterapp="controlpanel") and 
decorated the functions with @auth.requires_login() and set
auth.settings.login_url = URL('controlpanel', 'default', 'user', 
args='login')

I removed def user(): from the init application.

Is there a setting to not just set the login_url but to set all urls, 
something like:

auth.settings.user_url = URL('controlpanel', 'default', 'user')


Kind regards,

Annet.

-- 
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: auth.settings user_url

2019-02-26 Thread Leonel Câmara
It's

auth.settings.login_url

which you should change.

Probably you also want to change:

auth.settings.verify_email_next
auth.settings.request_reset_password_next

-- 
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] hidden field on CRUD

2019-02-26 Thread Diego Tostes
Hi,

i have this controller:

def cria_servico():
crud.settings.create_next = URL('default', 'dashboard')
form = crud.create(db.service)


I have a field on db.service named user_id. I whant to force the form to
fill this field with the auth_user.id of the user. How can i hidden this
field? because on creation i can set the user id...

crud.settings.create_onvalidation.servico.append(lambda
form:form.vars.update(user_id=user_id))


rgds


Diego

-- 
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: hidden field on CRUD

2019-02-26 Thread Diego Tostes
Done.

I did using the table definitions ...

Field('user_id', 'integer',writable=False
,readable=False,default=user_dic["user_id"])



Em ter, 26 de fev de 2019 09:34, Diego Tostes  escreveu:

> Hi,
>
> i have this controller:
>
> def cria_servico():
> crud.settings.create_next = URL('default', 'dashboard')
> form = crud.create(db.service)
>
>
> I have a field on db.service named user_id. I whant to force the form to
> fill this field with the auth_user.id of the user. How can i hidden this
> field? because on creation i can set the user id...
>
> crud.settings.create_onvalidation.servico.append(lambda
> form:form.vars.update(user_id=user_id))
>
>
> rgds
>
>
> Diego
>
>
>
>
>

-- 
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: Custom Delimiters Broken in 2.18.1?

2019-02-26 Thread Kevin Keller
Saw a 2.18.2 commit.
Was that addressed in thst commit?

Thanks!



On Mon, 25 Feb 2019, 06:08 Massimo Di Pierro, 
wrote:

> Damn you are right. I am releasing 2.18.2 with a fix.
>
> On Sunday, 24 February 2019 18:31:27 UTC-8, Limedrop wrote:
>>
>>
>> Hi there,
>>
>> I think the custom template delimiters are broken in 2.18.1.  Here's my
>> test code and the exception I'm getting:
>>
>>
>> CONTROLLER
>> def index():
>> response.delimiters = ('')
>> return dict(message=T('Welcome!'))
>>
>> VIEW - index.html
>> {{extend 'layout.html'}}
>>  Note that each column needs at least {{minCards}}
>> cards.
>>
>> EXCEPTION
>> File "\web2py2.18.1\web2py\gluon\restricted.py", line 230, in restricted
>> sys.excepthook(etype, evalue, tb) File
>> "c:\Users\Playtech\Documents\Development\web2py2.18.1\web2py\applications\app\views\default\index.html",
>> line 2, in 
>> NameError: name 'minCards' is not defined
>>
>>
>> Or have I done something wrong?
>>
>> 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.


Re: [web2py] Re: Custom Delimiters Broken in 2.18.1?

2019-02-26 Thread Tiago Alves
I am using custom delimiters, all working fine...

> On 26 Feb 2019, at 13:24, Kevin Keller  wrote:
> 
> Saw a 2.18.2 commit.
> Was that addressed in thst commit?
> 
> Thanks!
> 
> 
> 
>> On Mon, 25 Feb 2019, 06:08 Massimo Di Pierro,  
>> wrote:
>> Damn you are right. I am releasing 2.18.2 with a fix.
>> 
>>> On Sunday, 24 February 2019 18:31:27 UTC-8, Limedrop wrote:
>>> 
>>> Hi there,
>>> 
>>> I think the custom template delimiters are broken in 2.18.1.  Here's my 
>>> test code and the exception I'm getting:
>>> 
>>> 
>>> CONTROLLER
>>> def index():
>>> response.delimiters = ('') 
>>> return dict(message=T('Welcome!'))
>>> 
>>> VIEW - index.html
>>> {{extend 'layout.html'}}
>>>  Note that each column needs at least {{minCards}} 
>>> cards.
>>> 
>>> EXCEPTION   
>>> File "\web2py2.18.1\web2py\gluon\restricted.py", line 230, in restricted
>>> sys.excepthook(etype, evalue, tb) File 
>>> "c:\Users\Playtech\Documents\Development\web2py2.18.1\web2py\applications\app\views\default\index.html",
>>>  line 2, in 
>>> NameError: name 'minCards' is not defined
>>> 
>>> 
>>> Or have I done something wrong?
>>> 
>>> 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.


[web2py] Re: Get files from string

2019-02-26 Thread Leonel Câmara
How are you making the ajax call? Do you have processData: false and 
contentType: false in your options?

-- 
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-26 Thread Константин Комков
Leonel Câmara, yes I have. Difference in topic before I sent only files in 
FormData, now I send variables email, phone and variable files which 
contain js array - endUserFiles.
>
> Ajax function:
> jQuery.ajax({
> type: "POST",
> url: "loadDocs",
> data: data,
> cache: false,
> processData: false,
> contentType: false,
> success: function(data) {
> $('#results').html(data);
> $('.cssload-loader').hide();
> },
> error: function(data){
> $('.cssload-loader').hide();
> }
> });

-- 
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-26 Thread Leonel Câmara
You should append the files directly to formdata instead of pushing them 
into the endUserFiles and appending an array. It's ok to put multiple 
values in the same key in formdata using append

for (var i = 0;ihttp://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: standalone templates

2019-02-26 Thread Carlos Cesar Caballero Díaz
We still are not working in models, we want to treat some rough edges 
first with controllers overriding and views. But it should be included 
as an app component (just like cache and session).


Greetings.

El 26/2/19 a las 12:41 a.m., Massimo Di Pierro escribió:

nice work. Have you used it with pydal?

On Monday, 25 February 2019 10:04:43 UTC-8, Carlos Cesar Caballero wrote:

Hi Massimo,sorry about the delay in responding, I was really busy
last week. There is a small example of what we get right now (now
using yatl) https://github.com/daxslab/mojito


BTW the new helpers and refactored code looks much better.

Greetings.

El 18/2/19 a las 1:49 p.m., Massimo Di Pierro escribió:

I did some more refactoring. :-)
not sanitizer and helpers (similar to web2py ones) are part of yatl

can you provide an example of how to use
https://github.com/daxslab/ron


On Sunday, 17 February 2019 19:30:59 UTC-8, Carlos Cesar
Caballero wrote:

Awesome!! I will test it ASAP. A colleague and I have been
playing with your idea of a bottle-based framework and it has
became a quite good exercise. So far right now we got this
https://github.com/daxslab/ron

Greetings.

El 17/2/19 a las 9:52 p.m., Massimo Di Pierro escribió:

Thanks for all your help with templates.

So far I have posted this:
https://pypi.org/project/yatl/
and this:
https://github.com/web2py/yatl

I could use some more help with testing. if we are good we
can switch web2py to use this.
-- 
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.


--
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 version 2.18.2 Communications Error when in Admin.

2019-02-26 Thread John McMaster
Just installed web2py version 2.18.2 and now I get a communications error 
when I save changes in an app.

I get nothing in the error logs. 

The apps run but when I go to edit them and click the save button at the 
top of the lefthand page I  get a red communications error in the field to 
the right of "Last saved on:"  <<< here that looks like this:
Save file: [save disk icon] Saved file hash:  Last saved on:  toggle 
breakpoint


I have restarted the uwsgi and checked the logs only to see that all has 
run cleanly.  I was getting a message that "probable another instance of 
uWSGI is running on the same address (127.0.0.1:9) where 9 is the 
port number assigned.
I killed all instances and restarted the uWSGI and all is clean.

However I still get an comunications error.

Any ideas as to where to look for issues / configuration problems?

Thank you 



-- 
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] Problem updating list stored in session

2019-02-26 Thread Jon Subscripted
Hi everyone,
I'm having some trouble updating session data.

I have a controller/view that allows to perform a query that returns a
bunch of db ids. As I will be using these ids and I used a complex query to
retrieve them I store them in the session,  with the statement below.
Thus another controller will be able to randomly pick one of these ids in
order to use it.

def list_problems_by_training():
training_id = request.args(0,cast=int,default=1)
...
rows = db(query).select(db.probdata.problem,limitby=(start,stop))

if session.training_id is None:
session.training_id = 0
session.user_training_probs = []
session.configuration_counter = 0 #REMOVE: for debugging purposes
only

session.training_id = training_id
session.user_training_probs = list(set([r.problem  for r in
rows]))#remove duplicates
session.configuration_counter += 1 #REMOVE: for debugging purposes only
return locals()

It works fine the 1st time. But once the values are set in the session
object, when I go the the same controller/view to update the list, I'm no
longer able to change it.
It's weird because the view shows the new query results correctly, but the
session data never gets updated. But neither 'training_id' nor
'user_training_probs' are updated correctly. The curious thing is that I
set a counter variable for debugging purposes 'configuration_counter' and
it's updated correctly.

Is the problem related with data types? I deliberately avoided using user
classes (as stated in the manual
http://web2py.com/books/default/chapter/29/04/the-core#Don-t-store-user-defined-classes-in-session
) and used a regular list instead (which is a built-in datatype).

Am I doing something wrong? Is it ok to store query results in the session
or should I cache the result instead?
Thanks in advance.
Regards, Jon.

-- 
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-26 Thread Yi Liu
fixed in 2.18.2

On Monday, February 25, 2019 at 4:38:21 PM UTC-8, Yi Liu wrote:
>
> A python 3 bug:
>
>  'dict' object has no attribute 'iteritems'
> Version  
> web2py™ Version 2.18.1-stable+timestamp.2019.02.24.06.24.15
> Python Python 3.7.2: 
> /Users/LaVie/.pyenv/versions/miniconda3-4.3.11/bin/python (prefix: 
> /Users/LaVie/.pyenv/versions/miniconda3-4.3.11)
>
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "/Users/LaVie/Documents/Python/web2py/gluon/restricted.py", line 219, 
> in restricted
> exec(ccode, environment)
>   File 
> "/Users/LaVie/Documents/Python/web2py/applications/biolog/controllers/default.py"
>  , line 79, 
> in 
>   File "/Users/LaVie/Documents/Python/web2py/gluon/globals.py", line 421, in 
> 
> self._caller = lambda f: f()
>   File 
> "/Users/LaVie/Documents/Python/web2py/applications/biolog/controllers/default.py"
>  , line 70, 
> in index
> columns=columns)
>   File "/Users/LaVie/Documents/Python/web2py/gluon/sqlhtml.py", line 3427, in 
> __init__
> for colname, field in fieldmap.iteritems():
> AttributeError: 'dict' object has no attribute 'iteritems'
>
> Error snapshot
>
> AttributeError('dict' object has no attribute 'iteritems')
>   
>
>
>

-- 
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] Good service practice

2019-02-26 Thread xgp . latino
Hello,

Im a newbie coder. 
Im implementing an android app which make json post to web2py and transfer 
data in and out.
Actually my process is working, but I want to know if what i coded is right 
and offers the best performance.

def anyfunction():

  if request.vars.var1 == "something1":
 dosomething
 return response.json( { 'keyname' : 'keyvalue'} )
 

  return response.json( { 'error' : 'novar1'} )


Basically, im using a simple https post and extracting vars with 
request.vars.


Please share advice and comments,



Cheers,

-- 
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-26 Thread Ben Duncan
Given I have the following sweet alert js:

--
(async function getCompany () {
  const inputOptions = new Promise((resolve) => {
setTimeout(() => {
  resolve(myargs)
}, 2000)
  })

  const {value: company} = await Swal.fire({
title: 'Select Company',
input: 'radio',
inputOptions: inputOptions,
inputValidator: (value) => {
  return !value && 'You need to choose something!'
}
  })

  if (company) {
Swal.fire({html: 'You selected: ' + company})
  }
  return company
})
()
--

And i have the following code in the view:

{{if CHOOSE_COMPANY == 'Y' : }}
  {{ print "LOGIN view : choose: \n", CHOOSE_COMPANY }}
  {{print "LOGIN view : swalcompany fired \n"}}
  {{print "JSARGS is :\n", js_args}}
  {{=ASSIGNJS(myargs=js_args)}}
  {{=ASSIGNJS(myargs=js_args)}}
  var html_post = "center"
  

{{pass}}

AND in the controller:

if in_form.process(session=None, formname='login').accepted:
print "LOGIN: Accepts...\n"
response.flash = 'form accepted'
FRM_ERR = 'N'
CHOOSE_COMPANY = 'Y'
print "LOGIN: Accepts Trying the return \n"
return dict(form=in_form, FRM_ERR=FRM_ERR, js_args=js_args,
CHOOSE_COMPANY=CHOOSE_COMPANY)
redirect(URL('buttonbar'))
elif in_form.errors :
print "LOGIN: error...\n"
response.flash = 'form has errors'
FRM_ERR = 'Y'
return dict(form=in_form, FRM_ERR=FRM_ERR, js_args=js_args,
CHOOSE_COMPANY=CHOOSE_COMPANY)

I'm trying to accomplish 2 things:

A: get some value backup from the javascript file and
instead of the "return" under the accepted section of controller code, want
to set
a session value and then continue on to the redirect.

How do I go about doing both of theses's ??

As always, Thanks ...
\
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
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] another python 3 minor bug in 2.18.2: b'Logged in'

2019-02-26 Thread Yi Liu
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.


[web2py] Re: hidden field on CRUD

2019-02-26 Thread Dave S


On Tuesday, February 26, 2019 at 4:48:01 AM UTC-8, Diego Tostes wrote:
>
> Done.
>
> I did using the table definitions ...
>
> Field('user_id', 'integer',writable=False 
> ,readable=False,default=user_dic["user_id"])
>


Be aware that CRUD is deprecated, and support limited pretty much to 
security issues.  The preferred solutions are now SQLFORM.grid (or 
smartgrid) and SQLFORM.factory..

/dps


>
>
> Em ter, 26 de fev de 2019 09:34, Diego Tostes  > escreveu:
>
>> Hi, 
>>
>> i have this controller:
>>
>> def cria_servico():
>> crud.settings.create_next = URL('default', 'dashboard')
>> form = crud.create(db.service)
>>
>>
>> I have a field on db.service named user_id. I whant to force the form to 
>> fill this field with the auth_user.id of the user. How can i hidden this 
>> field? because on creation i can set the user id...
>>
>> crud.settings.create_onvalidation.servico.append(lambda 
>> form:form.vars.update(user_id=user_id))
>>
>>
>> rgds
>>
>>
>> Diego
>>
>>
>>
>>
>>

-- 
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] 2.18.2 translate function has gone from gluon.validators

2019-02-26 Thread Donald McClymont
I use Leonel Camara's excellent plugin location picker however it includes 
the following line

from gluon.validators import Validator, translate


it seems translate has become translator - but I haven't looked at in detail or 
fully followed - but need some guidance on how this is supposed to operate.


Are these sort of imports not supposed to be in applications or can something 
be done to avoid making this a breaking change.  


Regards

Donald



-- 
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.2 translate function has gone from gluon.validators

2019-02-26 Thread Leonel Câmara
This was a backwards incompatible change, I made a pull request changing it 
so you can keep using translate:
https://github.com/web2py/web2py/pull/2104

-- 
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.2 translate function has gone from gluon.validators

2019-02-26 Thread Donald McClymont
Many  thanks - I will resume testing once merged

Donald

-- 
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] Bad MySQL migration when there shouldn't be one?

2019-02-26 Thread Scott Hunter
I'm seeing the following error in a web2py 2.14.6 app @ pythonanywhere

OperationalError: (1553, "Cannot drop index 'f_User__idx': needed in a 
foreign key constraint")

This is an app that is using MySQL.  I have not changed any models, and all 
migrations are disabled, either of which not being true is what I might 
think could trigger this kind of error.  I do notice that everything in the 
compiled folder seems to have the same very recent timestamp, as if they 
were all touched recently.

I realize this is thin on details, but any ideas as to how I can a) track 
down the problem and more importantly b) solve it?

Here's the full traceback:

Traceback (most recent call last):
  File "/home/ukitms/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/ukitms/web2py/applications/init/compiled/models.db.py", line 
164, in 
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/base.py", line 834, in 
define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/base.py", line 873, in 
lazy_define_table
polymodel=polymodel)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 510, in create_table
fake_migrate=fake_migrate
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 623, in migrate_table
self.execute(sub_query)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 1388, in execute
return self.log_execute(*a, **b)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 1382, in log_execute
ret = self.get_cursor().execute(command, *a[1:], **b)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 
205, in execute
self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", 
line 36, in defaulterrorhandler
raise errorclass, errorvalue


- Scott




-- 
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] Using Http.Client module in my controls

2019-02-26 Thread elisha bere
Hello,

I am trying to implement Http.client so i can send bulk sms using my web2py
app. If i just import Http.Client i get an error. Please assist i have been
trying for weeks now but still no luck.

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