[web2py] Invalid field name although rname is set

2016-11-10 Thread Edwin Haver

Hello,

Why do I get the following error message when I have set the rname for that 
field and have set check_reserved to None?

 Field: invalid field name: update, use 
rname for "funny" namesVersion
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Python Python 2.7.12: C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File "C:\Users\Edwin\Applications\web2py\gluon\restricted.py", line 227, in 
restricted
exec ccode in environment
  File 
"C:/Users/Edwin/Applications/web2py/applications/create/models/db_tables.py" 
, line 24, 
in 
Field('update', rname='wac_update', type='string', default=None),
  File 
"C:\Users\Edwin\Applications\web2py\gluon\packages\dal\pydal\objects.py", line 
1438, in __init__
'use rname for "funny" names' % fieldname)
SyntaxError: Field: invalid field name: update, use rname for "funny" names



Regards, Edwin

-- 
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] scheduling multiple tasks

2016-11-10 Thread Nico de Groot
Looking at your code you posted earlier at 
http://stackoverflow.com/questions/34661782/web2py-function-not-triggered-on-user-request/34895532#34895532
 ou have a task running the engine. This task is scheduled by adding it adding 
it to the scheduler. You can create a second task and add this task using a 
one-time controller, a script, or at application  start time.

Nico de Groot

-- 
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: scheduling multiple tasks

2016-11-10 Thread Dave S


On Thursday, November 10, 2016 at 5:07:16 AM UTC-8, Yebach wrote:
>
> Hello
>
>
> In my web2py app i am using scheduler. So far I have one task scheduled 
> which runs a subprocess when called from controler (an external exe 
> file/application)
>
> Now i want to add another task which will do some background work
>
> My code in *scheduler.py* till now was
>
> def runWoshiEngine(scriptId, path):
>
>
> # import os, sys# import timeimport subprocessprint "runWoshiEngine in 
> progress.."
> p = subprocess.Popen(['woshi_engine.exe', scriptId], shell=True, stdout = 
> subprocess.PIPE, cwd=path)return dict(status = 1)
>
> from gluon.scheduler import Scheduler
> scheduler = Scheduler(db, heartbeat = 1)
>
>
> so this way the scheduler started on client's request
>
>
> after starting my app I run my scheduler with command
>
>
> python web2py.py -K myapp
>
>
> Now I want to add another function which will start every hour to do some 
> background work.
>
> What would you recommend and how to add it to scheduler because if i add 
> anything to my line of code my initial task --> exe app is not started
>
>
> thank you
>
>
> best regards
>


You're using the Popen because you're running something non-python, I take 
it.  And the  ".exe" suggests Windows environment.

I'm not sure why adding a line of code breaks your app start, but the 
recommended way of queuing the initial occurrence of a task that repeats 
periodically is to have a function in your controller file that has args 
(that makes it not be a URL target), and then use -S from the command line 
or from a startup file to invoke that function.

See 

for some sample code.  That's a PR that pending for the web2py book.

/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: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-10 Thread Dave S


On Wednesday, November 9, 2016 at 9:24:02 PM UTC-8, Mike Stephenson wrote:
>
> It's messed up.
>

How so?  What does it do?  What do you expect it to do?

Can you show us how your controller prepares the json?  What does your view 
look like?
 

> Can you help out with a code snippet? Will be of much help.
>

Does this one help?


/dps
 

> On Thursday, November 10, 2016 at 12:17:17 AM UTC+5:30, Leonel Câmara 
> wrote:
>>
>> What do you mean? What are you trying to do? How are you putting the json 
>> there? Are you getting it using $.getJSON or something like that?
>>
>
 

-- 
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: About web2py_component and redirect

2016-11-10 Thread Marco Mansilla
What I did was add a 0 option to select, and the fire a js event with
modal, using $.web2py.component works with a small issue, the first time it
fires opens and closes a new tab.

I will try to share it tonight, maybe someone else could find it useful.

El 10 nov. 2016 4:26 AM, "黄祥"  escribió:

i think you can use comment for that, n modify the css class to your own
css (assuming you have your own css)
e.g.
db.test.user.comment = A(_class="glyphicon glyphicon-plus-sign",
**{"_data-toggle":"modal", "_data-target":"#modal_auth_user"} ) if
has_membership_admin else None

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.


[web2py] auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-10 Thread António Ramos
i have a row in a table that want to protect from users
i have the field  as list:string like this
->["admin","supervisor","auditor"]

with auth_requiresmembership(role) i need role to be  string , not a list.

what is the best solution here?

regards
António

-- 
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] Unit Testing in PyCharm

2016-11-10 Thread 'Roman' via web2py-users
Thank you very much for the links, i will read and report my findings here.

Roman

Am Mittwoch, 9. November 2016 15:37:52 UTC+1 schrieb Richard:
>
> Not exactly what you want but it could help you understand testing with 
> web2py :
>
> https://github.com/viniciusban/web2py.test
>
> https://github.com/niphlod/welcome_augmented
>
> New initiative here : 
> https://groups.google.com/d/msg/web2py/hcsHgJiFEwc/apeBhnf0AgAJ
>
> Good read!
>
> RIchard
>
>
> On Thu, Nov 3, 2016 at 4:56 PM, 'Roman' via web2py-users <
> web...@googlegroups.com > wrote:
>
>> Hi people.
>>
>> Short question: is there a way to run unit tests for my web2py 
>> controllers from PyCharm?
>>
>> I am running the latest web2py with version:  2.14.6-stable
>>
>> What i found out so far:
>>
>> There is an approach to run unit tests from command line. Following this 
>> blogpost: http://web2py.com/AlterEgo/default/show/260 i am able to run a 
>> unit test for my controller. BUT just for convinience i want to let my IDE 
>> manage those tests (i.e. start them and show me the results in a PyCharming 
>> way).
>>
>> To let PyCharm run a unit test, you have to create a new run/debug 
>> configuration, you have to enter the location of a unit test script, to run 
>> it directly. PyCharm does some thing with "utrunner.py" (unit_test_runner?).
>> I tried to give the run/debug configuration the path to web2py.py and as 
>> parameter the "--shell= --import_models --run=my_script.py" 
>> thing. But unfortunately the "utrunner.py" needs well formatted unit test 
>> scripts.
>>
>> Prior to the mentioned blogpost, there was another approach to run unit 
>> tests for web2py controllers: 
>> http://www.web2py.com/AlterEgo/default/show/213
>> Unfortunately, as mentioned in the other post, going that way, my 
>> controller action is not able to see the db :-(
>>
>> Fazit:
>> Does anybody know a way how to run unit tests for my web2py controllers 
>> from PyCharm?
>> Or
>> Does anybody know how to run a unit test for my web2py controllers 
>> directly from command line (without web2py.py) and how can i pass a DAL 
>> object to the environment of my controller?
>>
>> Many thanks in advance and greetings from Berlin
>>
>> Roman
>>
>> -- 
>> 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] scheduling multiple tasks

2016-11-10 Thread Yebach


Hello


In my web2py app i am using scheduler. So far I have one task scheduled 
which runs a subprocess when called from controler (an external exe 
file/application)

Now i want to add another task which will do some background work

My code in *scheduler.py* till now was

def runWoshiEngine(scriptId, path):


# import os, sys# import timeimport subprocessprint "runWoshiEngine in 
progress.."
p = subprocess.Popen(['woshi_engine.exe', scriptId], shell=True, stdout = 
subprocess.PIPE, cwd=path)return dict(status = 1)

from gluon.scheduler import Scheduler
scheduler = Scheduler(db, heartbeat = 1)


so this way the scheduler started on client's request


after starting my app I run my scheduler with command


python web2py.py -K myapp


Now I want to add another function which will start every hour to do some 
background work.

What would you recommend and how to add it to scheduler because if i add 
anything to my line of code my initial task --> exe app is not started


thank you


best regards

-- 
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: send html emails?

2016-11-10 Thread António Ramos
solved.
Thank you

2016-11-10 11:51 GMT+00:00 António Ramos :

> nice.
> i get a path error
> invalid view...
>
> where is render looking for views?
> do i need a controller for the view or can i skip creating it?
>
> Regards
>
> 2016-11-10 11:34 GMT+00:00 黄祥 :
>
>> just an idea, why not use response.render, put the html template on there
>> e.g.
>> row = db(db.test.id == 1).iterselect().first()
>> mail_to = 'a...@a.com'
>> subject = 'test'
>> messages = response.render('templates/mail/test_0.html', dict(row = row)
>> )
>> mail.send(mail_to, subject, messages)
>>
>> 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: send html emails?

2016-11-10 Thread António Ramos
nice.
i get a path error
invalid view...

where is render looking for views?
do i need a controller for the view or can i skip creating it?

Regards

2016-11-10 11:34 GMT+00:00 黄祥 :

> just an idea, why not use response.render, put the html template on there
> e.g.
> row = db(db.test.id == 1).iterselect().first()
> mail_to = 'a...@a.com'
> subject = 'test'
> messages = response.render('templates/mail/test_0.html', dict(row = row) )
> mail.send(mail_to, subject, messages)
>
> 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.


[web2py] Re: send html emails?

2016-11-10 Thread 黄祥
just an idea, why not use response.render, put the html template on there
e.g.
row = db(db.test.id == 1).iterselect().first()
mail_to = 'a...@a.com'
subject = 'test'
messages = response.render('templates/mail/test_0.html', dict(row = row) )
mail.send(mail_to, subject, messages)

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] send html emails?

2016-11-10 Thread António Ramos
Hello i have an html that i want to send via mail.send("",htm("asas")
but i need to inject params.
I get this error

Traceback (most recent call last):
  File "C:\web2py\gluon\scheduler.py", line 315, in executor
result = dumps(_function(*args, **vars))
  File "applications\fileit\models\db2.py", line 460, in send_pending_emails
if
mail.send(to=row.sendto,subject=row.subject,message=("",html("asas")),sender=row.sender):
  File "applications\fileit\models\db2.py", line 456, in html
return temp % (f1)
ValueError: unsupported format character '!' (0x21) at index 602

Can i get some advise ?

temp="""
http://www.w3.org/1999/xhtml;
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office">




Template Base




  
/* Client-specific Styles & Reset */
#outlook a {
padding: 0;
}

/* .ExternalClass applies to Outlook.com (the artist formerly known as
Hotmail) */
.ExternalClass {
width: 100%;
}

.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}

#backgroundTable {
margin: 0;
padding: 0;
width: 100% !important;
line-height: 100% !important;
}

/* Buttons */
.button a {
display: inline-block;
text-decoration: none;
-webkit-text-size-adjust: none;
text-align: center;
}

.button a div {
text-align: center !important;
}

/* Outlook First */
body.outlook p {
display: inline !important;
}

/*  Media Queries */
@media only screen and (max-width: 500px) {
  table[class="body"] img {
height: auto !important;
width: 100% !important; }
  table[class="body"] img.fullwidth {
max-width: 100% !important; }
  table[class="body"] center {
min-width: 0 !important; }
  table[class="body"] .container {
width: 95% !important; }
  table[class="body"] .row {
width: 100% !important;
display: block !important; }
  table[class="body"] .wrapper {
display: block !important;
padding-right: 0 !important; }
  table[class="body"] .columns, table[class="body"] .column {
table-layout: fixed !important;
float: none !important;
width: 100% !important;
padding-right: 0px !important;
padding-left: 0px !important;
display: block !important; }
  table[class="body"] .wrapper.first .columns, table[class="body"]
.wrapper.first .column {
display: table !important; }
  table[class="body"] table.columns td, table[class="body"] table.column
td, .col {
width: 100% !important; }
  table[class="body"] table.columns td.expander {
width: 1px !important; }
  table[class="body"] .right-text-pad, table[class="body"] .text-pad-right {
padding-left: 10px !important; }
  table[class="body"] .left-text-pad, table[class="body"] .text-pad-left {
padding-right: 10px !important; }
  table[class="body"] .hide-for-small, table[class="body"]
.show-for-desktop {
display: none !important; }
  table[class="body"] .show-for-small, table[class="body"]
.hide-for-desktop {
display: inherit !important; }
  .mixed-two-up .col {
width: 100% !important; } }
 @media screen and (max-width: 500px) {
  div[class="col"] {
  width: 100% !important;
  }
}

@media screen and (min-width: 501px) {
  table[class="container"] {
  width: 500px !important;
  }
}
  
  
  
  

  

  





  

  
%s
  

  


  

  
Field2
  

  





  

  
  

  





  

  
Field3
  

  


  

  
Field4
  

  


  

  
Field5
  

  


  

  

  



  


   Button
  
  

  
  
  

  

  





  

  
  

  





  

  
Field6
  

  





  

  
  
  
  


"""

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