Re: [web2py] Re: how to define DAL in pythonanywhere ????

2016-06-02 Thread Anthony
If you're getting that error, either this code is not in a web2py model or 
controller file, or something is very wrong with your setup. We need more 
details.

Anthony

On Thursday, June 2, 2016 at 1:42:08 AM UTC-4, prashant joshi wrote:
>
> it is not work it show  error "NameError: name 'DAL' is not defined"
>
> On Thu, Jun 2, 2016 at 1:47 AM, 黄祥  wrote:
>
>> pls try :
>> mysql://pythonuser:MySQLpwd@mysql.server/pythonuser$MySQLdb
>>
>> note :
>> - pythonuser is your pythonanywhere username
>> - MySQLpwd is your MySQL Password in pythonanywhere
>> - MySQLdb is your database mysql that store data for application
>>
>> 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 Creating Controls Dynamically

2016-06-02 Thread Fabiano Almeida
Hi!

See
http://www.web2pyslices.com/slice/show/1724/cascading-dropdowns-simplified



2016-05-25 14:43 GMT-03:00 Venkat :

> Hi
>
> I have a requirement of displaying data from database from 4 tables i used
> join to pull all the data but i should display that data in dropdown for
> each column, how can i build these dropdowns dynamically? user will see
> that past data and will be able to select an option from that drop down
> and submit that data. i should be able to build those controls dynamically
> for all the records that i pull based on user and dates
>
> --
> 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: Mercurial Error

2016-06-02 Thread Dave S
On Wednesday, June 1, 2016 at 8:37:38 PM UTC-7, greenpoise wrote:
 

>
> Thanks but is this to work from the shell? I would love to use the version 
> control from web2py admin interface.
>
> Thanks again 
>

>From the command line.  The web shell web2py has provided is deprecated, 
and is a Python shell anyway.

I've not used the admin source-control interface for a while, going back to 
before the mismatch issue, because I make short-lived branches, and that 
isn't supported by web2py.  I also have arcane formatting for my hg log 
command, and also check things into an SVN archive, so my workflow is 
different from the in-the-box setup.


/dps
 

>
> On Wednesday, June 1, 2016 at 4:57:50 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Wednesday, June 1, 2016 at 4:12:50 PM UTC-7, Dave S wrote:
>>>
>>>
>>>
>>> On Wednesday, June 1, 2016 at 3:05:15 PM UTC-7, greenpoise wrote:

 My version control is not working. Any ideas? this is the error I get. 
 Could it be a mercurial version error?

>>>
>>> The web2py interface to Mercurial seems to use internal APIs, which are 
>>> subject to change.  Do your Mercurial from the command line.
>>> You should only need to do "hg ci -m 'changes made to resolve problem 
>>> xyz'" and "hg log | less" or "hg log | head -n 40"
>>> (that's about all the web2py usage amounted to, IIRC).
>>>
>>
>>
>> Obviously, I missed the "hg addremove" subcommand.   (I usually do the 
>> separate  "hg add" and "hg remove").
>> Try it with "hg addremove --dry-run" if you have questions about what it 
>> will add or remove.
>>
>>
>>> "hg help" is a quick guide to Mercurial.  The official website is at
>>> https://www.mercurial-scm.org>, 
>>> and I can answer a lot of simple questions (I'm not quite a power user, 
>>> but pretty comfortable with a lot of stuff).
>>>
>>> /dps
>>>
>>>
>> That's me.
>>
>> /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] web2py 1.89.5

2016-06-02 Thread Frank Camp
Using google I found this one.  
http://www.imperiasoft.com/office-tools/pdf/web2py-1-89-5.html#

Like everything downloaded from the internet, check before you use. You never 
know what is inside an archive.

Frank

-- 
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] method not allowed

2016-06-02 Thread Eduardo Pereira
I am having a strange problem. 
I'm am running a my application in webfaction server with the following 
configuration:

 Apache/2.4.16 (Unix) mod_wsgi/4.4.13 Python/2.7.11, Python 2.7.11

And my restful return 
  method not allowed

However the same application is running without problem with the following 
configuration in the webfaction server
Running on Apache/2.2.25 (Unix) mod_wsgi/3.4 Python/2.7.11, Python 
2.7.11


-- 
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] Is there a way to make scheduler tasks be picked by workers up even quicker?

2016-06-02 Thread Mark Smith
So I've been struggling with this issue for a while. Here's the scenario: 

The user selects their desired options and then clicks submit. The 
javascript then sends a POST request to a controller that adds a task to 
the task database. The javascript then polls every second to check on the 
status of the task and when the task is complete the results are sent back.

All of the tasks take max 1-2 seconds to run. However, it usually takes 
around 6 seconds for the scheduler to assign the task to a worker and for 
the worker to actually pick up and run the task (heartbeat is set to 2). 
Here's a log showing what I mean:

2016-06-02 01:33:00,657  - DEBUG - Adding task to scheduler
2016-06-02 01:33:00,670  - DEBUG - Done adding task to scheduler
2016-06-02 01:33:01,060  - DEBUG - scheduler_task: QUEUED
2016-06-02 01:33:03,253  - DEBUG - scheduler_task: QUEUED
2016-06-02 01:33:05,198  - DEBUG - scheduler_task: QUEUED
2016-06-02 01:33:07,196 - DEBUG - scheduler_task: ASSIGNED
2016-06-02 01:33:09,280 - DEBUG - new task report: COMPLETED

The time it takes from "Done adding task to schedule" to "new task report: 
COMPLETED" is about 8 seconds. Given that the tasks only take max 1-2 
seconds to run I would really like to cut down on the time it takes for it 
to be assigned and picked up by a worker.

Here's some more information (if you need anymore please tell me!):

In models I have *scheduler.py* where I initialize the scheduler:

import resultEngine // importing from the web2py modules directory
scheduler = Scheduler(taskdb, tasks=dict(getResult=resultEngine.getResult), 
heartbeat = 2)

In *default.py*:
def queueTask():
   session.task = scheduler.queue_task('getResult', [options_list], 
timeout=60, immediate=True)

I'm using sqlite as the database for the scheduler, I'm running my webapp 
on pythonanywhere and have 5 workers.

Is there a way to cut down on the time for a task to actually be picked up 
and run by a worker (to like 1 second)?. I spent a lot of time optimizing 
the tasks so that they could be run in 1-2 seconds so I really want to show 
snappy behaviour. Any help is appreciated! Loving web2py :)!

-- 
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 to pass label and value from controller IS_IN_SET validator

2016-06-02 Thread Tadas Talaikis
Hey guys,

For example, I have this field in the SQLFORM:

Field('things[]', requires=IS_IN_SET([e for e in lthings_ist], 
multiple=True))

where e is a dict of values. How I can pass option label and option value 
in this selection list when I *don't* use the view?

-- 
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 do I display a link to an 'upload' field in my table?

2016-06-02 Thread Steven Vannoy
I have a DAL table that contains an upload field. After a user fills in the 
form and selects a file via the "Choose File" button, I want to display the 
form the just filled out but not in an editable form. So I have a 
controller/view pair called "view_the_form"

In view_the_form.html I want to have a link so the user could download that 
previously 'uploaded' file. I can't seem to get a valid link.

I've been trying variations on the following:

{{=A(T("Brochure"), _href=URL('appname','uploads',row.brochure))}}


Where "row.brochure" is the selected row from my db.table and brochure is 
the name of the upload field. I can see that row.brochure is correct, it 
contains the name of the file that is in the uploads directory. But, when I 
click on that link in the browser, I get an "invalid function 
 (default/uploads)" message. The URL that is attempted is:

http://127.0.0.1:8000/uploads/sites.brochure.befaec15341b61de.6261636b67726f756e642e6a7067.jpg

Can someone help me figure out how to provide a link to an attachment in my 
db.table when viewing the table in a non-form format?

Thanks
Steven

-- 
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 to insert values into list:string

2016-06-02 Thread lonihiat
New user question:

How we push values into field that are defined list:string. For example

db.define('mytable', Field('myfield', 'list:string'))

in the controller, db.mytable.insert(myfield = ['mystring1', 
'mystring2'...) doesn't get the same result as I would insert them from 
admin panel. Can't seem to find that in the book. If someone point that out 
will be very helpful

I heard this community is very helpful. So, thanks in advance.


-- 
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] Is it possible to hide some value inside set of the field?

2016-06-02 Thread Tadas Talaikis
Hey guys,

For example, I have a bunch of rows with IS_IN_SET validator inside the 
field an want to dispaly some columns, but hide others. More specifically, 
is it possible to hide them and still have them available for later use?

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.


[web2py] Re: web2py 1.89.5

2016-06-02 Thread Roman Molotkovski
Just checked the version file. It's says Version 
2.14.6-stable+timestamp.2016.05.10.00.21.47. :(

On Thursday, June 2, 2016 at 10:28:55 PM UTC+3, Frank Camp wrote:
>
> Using google I found this one.  
> http://www.imperiasoft.com/office-tools/pdf/web2py-1-89-5.html# 
>
> Like everything downloaded from the internet, check before you use. You 
> never know what is inside an archive. 
>
> Frank

-- 
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: Is it possible to hide some value inside set of the field?

2016-06-02 Thread Anthony
What do you mean by "rows"? Are you using the grid?

In general, you should show some code. In this case, show whatever code is 
producing your output as well as any relevant model definitions.

Anthony

On Thursday, June 2, 2016 at 3:28:54 PM UTC-4, Tadas Talaikis wrote:
>
> Hey guys,
>
> For example, I have a bunch of rows with IS_IN_SET validator inside the 
> field an want to dispaly some columns, but hide others. More specifically, 
> is it possible to hide them and still have them available for later use?
>
> 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.


[web2py] Re: How to insert values into list:string

2016-06-02 Thread Anthony


> db.define('mytable', Field('myfield', 'list:string'))
>
> in the controller, db.mytable.insert(myfield = ['mystring1', 
> 'mystring2'...)
>

Looks correct so far. Is that your *real* code?
 

> doesn't get the same result as I would insert them from admin panel.
>

What does "same result" mean? How are you assessing the result? What do 
your appadmin entries look like?
 
Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to 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 to pass label and value from controller IS_IN_SET validator

2016-06-02 Thread Anthony
As noted at the very end of this section 
,
 
you can pass a list of tuples or dictionaries to specify labels for each 
value. Not sure what you mean by "when I *don't* use the view".

Anthony

On Thursday, June 2, 2016 at 3:28:55 PM UTC-4, Tadas Talaikis wrote:
>
> Hey guys,
>
> For example, I have this field in the SQLFORM:
>
> Field('things[]', requires=IS_IN_SET([e for e in lthings_ist], 
> multiple=True))
>
> where e is a dict of values. How I can pass option label and option value 
> in this selection list when I *don't* use the view?
>

-- 
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] reading values from request.vars

2016-06-02 Thread ktesr123456
I am getting selected values from View to Controller using request.vars

I can see the values are coming as key value pair but not able to figure 
out how to read each value and insert them in DB


-- 
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: Append fields within form, iteratively add fields inside form, List:string append, custom forms

2016-06-02 Thread Mark Graves
Hey Ron,

This looks like an architectural issue to me.

You have to maintain state somehow for the form2 vars.

You can either do this via javascript on the client side, then have only 
one form server side, which has a dynamic set of fields.

If i were to do it this way, I would use a javascript library similar 
to https://github.com/marioizquierdo/jquery.serializeJSON

I have used this in the past, and then set up the controller much more 
simply to handle storing and retrieving JSON.

If you need to do row by row processing, you can filter out the JSON and 
store it in rows server side,

Otherwise, you can store it server side, let me know if you want to chat 
about this offline.

-Mark

On Friday, May 27, 2016 at 2:22:16 PM UTC-7, Ron Chatterjee wrote:
>
> Running into some issues and hoping community help out with thoughts. How 
> do I append to list:string and using form inside a form (custom form). 
>
> Question: How do I append skill_and_experience  as a list:string into the 
> field added_term as 'English': '1 year', 'Math':'2 years',...etc. 
>
> May be there is a better way to do this, but this is how I started out 
> with. 
>
>
> *Model.py:*
>
> db.define_table( 'Experience',Field('Experience_level'), format = 
> '%(Experience_level)s')
> db.define_table( 'teaching',Field('teach_string'), format = 
> '%(teach_string)s')
>
>
> db.define_table( 'add_list_item',
> Field('skill_list', db.teaching, label='Enter Your Skills 
> sets', comment = 'Enter skills'),
> Field('Experience_list', db.Experience, label='Enter Your 
> Experience',  comment = 'Enter years'))
> 
>
> db.define_table( 'Project', 
> Field("Title", "string", 
> requires=IS_NOT_EMPTY(),default=None),
> Field("added_term", "list:string", 
> requires=IS_NOT_EMPTY()),)
>
>
>
> *Controller:*
> def create_table():
> a_list = 'My skills and experience:'
> skill_and_experience = [];
>  
> form1 = SQLFORM(db.Project)
> form2 = SQLFORM(db.add_list_item, submit_button=' + Add',).process()
> form2.element('input[type=submit]').update(_class='btn btn-custom')
> 
> if form2.accepted:
> a = db(db.add_list_item.id == form2.vars.id).select().first()
> skills = db(db.teaching.id == a.skill_list).select().first()
> experience = db(db.Experience.id == 
> a.Experience_list).select().first()
> skill_and_experience = skills.teach_string+':' +''+ 
> experience.Experience_level
> added_term.append(skill_and_experience)
> response.flash = T("Added Experience")
> 
> if form1.accepted:
> response.flash = T("success!")
> 
> return dict(form1 = form1, form2 = form2, a_list = a_list)
>
>
> *View:*
>
> {{extend 'layout.html'}}
>
> 
>
> {{=form1.custom.begin}}
>
>
> 
> {{=form1.custom.widget.Title}}
>  
> 
> {{=form2.custom.begin}}
>
> {{=a_list}}
>
>
>
> 
> 
>   
>   
>  
>{{=form2.custom.widget.skill_list}}   
>
> {{=form2.custom.widget.Experience_list}}   
>   
>  
>{{=form2.custom.submit}}
>   
> 
> 
>  
> 
> 
> {{=form2.custom.end}}
>   
>  {{=form1.custom.submit}}
> 
> 
>  
>   
> 
> 
> {{=form1.custom.end}}
> 
>
> 
> .input-title{
> height: 100px;
> width: 400px;
> }
>
> #add_list_item_skill_list{
>  width: 200px;
> } 
> #add_list_item_Experience_list{
>  width: 200px;
> } 
>
>
> .btn-custom { text-align:right;color: blue;width:50px; 
> padding:20%;position: relative;top: -4px;left: 4px;height 20px;}   
> 
>
>
>
> The idea is to basically add experience and training using form2 and add 
> that to form1 and then process both. But I am having problem in appending 
> data into list:string like I would for project. 
>
> Project.id 
> 
> Project.Title2 
> 
> Project.added_term2 
> 
> 1  test1 
> test1
> 2  test2 test1, 
> test2, test3
> 3  test3 
> test23, 
> test32
>

-- 
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 do I display a link to an 'upload' field in my table?

2016-06-02 Thread Dave S


On Thursday, June 2, 2016 at 12:28:54 PM UTC-7, Steven Vannoy wrote:
>
> I have a DAL table that contains an upload field. After a user fills in 
> the form and selects a file via the "Choose File" button, I want to display 
> the form the just filled out but not in an editable form. So I have a 
> controller/view pair called "view_the_form"
>
> In view_the_form.html I want to have a link so the user could download 
> that previously 'uploaded' file. I can't seem to get a valid link.
>
> I've been trying variations on the following:
>
> {{=A(T("Brochure"), _href=URL('appname','uploads',row.brochure))}}
>
>
> Where "row.brochure" is the selected row from my db.table and brochure is 
> the name of the upload field. I can see that row.brochure is correct, it 
> contains the name of the file that is in the uploads directory. But, when I 
> click on that link in the browser, I get an "invalid function 
>  (default/uploads)" message. The URL that is attempted is:
>
>
> http://127.0.0.1:8000/uploads/sites.brochure.befaec15341b61de.6261636b67726f756e642e6a7067.jpg
>
> Can someone help me figure out how to provide a link to an attachment in 
> my db.table when viewing the table in a non-form format?
>
> Thanks
> Steven
>

I build a similar link, but send it in an email  (to a support desk 
person).  I use this (adjusted for your context)
 A(" (GET BROCHURE)", _href="http://oursupport.com"; + URL("download", args=
row.brochure))

This sends a link to the  download() controller from the sample default.py 
(adjusted to do some logging), with the appropriate file as an argument.

/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: method not allowed

2016-06-02 Thread Dave S


On Thursday, June 2, 2016 at 12:28:55 PM UTC-7, Eduardo Pereira wrote:
>
> I am having a strange problem. 
> I'm am running a my application in webfaction server with the following 
> configuration:
>
>  Apache/2.4.16 (Unix) mod_wsgi/4.4.13 Python/2.7.11, Python 2.7.11
>
> And my restful return 
>   method not allowed
>
> However the same application is running without problem with the following 
> configuration in the webfaction server
> Running on Apache/2.2.25 (Unix) mod_wsgi/3.4 Python/2.7.11, Python 
> 2.7.11
>

You probably need to show us some code, at least to the skeleton of the 
controller, and perhaps the URL that isn't working.

/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: reading values from request.vars

2016-06-02 Thread Anthony
Please show some code and explain exactly what you want to do. To get a 
particular value from request.vars, just do request.vars.name_of_variable.

Anthony

On Thursday, June 2, 2016 at 8:07:13 PM UTC-4, ktesr123...@gmail.com wrote:
>
> I am getting selected values from View to Controller using request.vars
>
> I can see the values are coming as key value pair but not able to figure 
> out how to read each value and insert them in DB
>
>
>

-- 
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 do I display a link to an 'upload' field in my table?

2016-06-02 Thread Steven Vannoy


On Thursday, June 2, 2016 at 9:14:38 PM UTC-4, Dave S wrote:
>
>
>
> On Thursday, June 2, 2016 at 12:28:54 PM UTC-7, Steven Vannoy wrote:
>>
>> I have a DAL table that contains an upload field. After a user fills in 
>> the form and selects a file via the "Choose File" button, I want to display 
>> the form the just filled out but not in an editable form. So I have a 
>> controller/view pair called "view_the_form"
>>
>> In view_the_form.html I want to have a link so the user could download 
>> that previously 'uploaded' file. I can't seem to get a valid link.
>>
>> I've been trying variations on the following:
>>
>> {{=A(T("Brochure"), _href=URL('appname','uploads',row.brochure))}}
>>
>>
>> Where "row.brochure" is the selected row from my db.table and brochure is 
>> the name of the upload field. I can see that row.brochure is correct, it 
>> contains the name of the file that is in the uploads directory. But, when I 
>> click on that link in the browser, I get an "invalid function 
>>  (default/uploads)" message. The URL that is attempted is:
>>
>>
>> http://127.0.0.1:8000/uploads/sites.brochure.befaec15341b61de.6261636b67726f756e642e6a7067.jpg
>>
>> Can someone help me figure out how to provide a link to an attachment in 
>> my db.table when viewing the table in a non-form format?
>>
>> Thanks
>> Steven
>>
>
> I build a similar link, but send it in an email  (to a support desk 
> person).  I use this (adjusted for your context)
>  A(" (GET BROCHURE)", _href="http://oursupport.com"; + URL("download", args
> =row.brochure))
>
> This sends a link to the  download() controller from the sample default.py 
> (adjusted to do some logging), with the appropriate file as an argument.
>
> /dps
>

 

> Thanks Dave, I see now how the download controller works, that was where 
> my confusion got the best of me.
>
at this point I have

 {{=A(T("Brochure"), _href=URL('appname', 'default', 'download'
,args=row.brochure))}}

And it is working

-- 
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: reading values from request.vars

2016-06-02 Thread ktesr123456
Anthony

I wanted to iterate all the values from request.vars these values are 
passed using ajax function from View, in the View each row will have 3 drop 
downs and 1 textbox to take input from user
there can be minimum 1 row. I am passing all the control names thru ajax 
function

View
===

/* jquery that builds html form written here */

ajax('{{=URL('insert_data')}}',['opt1','opt2','opt3','txtt1'],'target'); // 
opt1, opt2 and opt3 are dropdown control names and txt1 is the name if 
textbox control all are html controls dynamically crated using jquery





Controller
==
def insert_timesheet():
 
 orglist = request.vars.getlist("opt1")
 response.flash = str(orgval)

 ##db.Table.insert(field1=opt1[0],.)
 return locals()



On Thursday, June 2, 2016 at 7:34:04 PM UTC-6, Anthony wrote:

> Please show some code and explain exactly what you want to do. To get a 
> particular value from request.vars, just do request.vars.name_of_variable.
>
> Anthony
>
> On Thursday, June 2, 2016 at 8:07:13 PM UTC-4, ktesr...@gmail.com 
>  wrote:
>>
>> I am getting selected values from View to Controller using request.vars
>>
>> I can see the values are coming as key value pair but not able to figure 
>> out how to read each value and insert them in DB
>>
>>
>>

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