Re: [web2py] Re: is_list_of validator question

2014-11-18 Thread Manuele Pesenti
Il 18/11/14 05:54, Massimo Di Pierro ha scritto:
> Problem is that IS_LIST_OF experts to validate a list. Instead you are
> passing "" (not a list) and None (also not a list).
> I agree that it is odd that interprets '' as [] and None as [None].
> They should either be interpreted as [''] and [None] or both as an
> empty list.
>
> Your proposed fix makes sense and I would take a patch.
Thank you Massimo!

the problem is that every time you don't insert any value in the field a
null string is validated (i.e. "").
As I can see from code[1] it seams to me the validator expects any kind
of value and if it's not a list/tuple it insert into a list and validate it.
Another problem is that[2] if the result of the operation
str(item).strip() is evaluated as False any validation is applied... so
there's no way to oblige the user not to pass a null value (i.e. to
insert any value).

Could it be ehough to remove the line 2520[2]? Why it has been introduced?

Cheers

Manuele


[1] https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2508
[2] https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2520

-- 
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: RSS is an error! What to do?

2014-11-18 Thread damufo

on web2py 2.9.5
obj[key]  I pass a unicode

Solution
now pass
obj[key] a string

and on gluon/serializers.py line 167 I changed (encode for decode)

return str(obj[key]).encode('utf-8', 'replace') if key in obj else default
for
return str(obj[key]).decode('utf-8', 'replace') if key in obj else default

now work fine for me.

I think the problem is in encode fail when is a string (with special 
characters)



El martes, 18 de noviembre de 2014 08:57:39 UTC+1, dam...@gmail.com 
escribió:
>
> Hi:
> This patch broke my rss.
> When update web2py 2.9.5 to 2.9.11 the RSS produces an encoding error.
>
>
> Ticket ID 
>>
>> 192.168.0.109.2014-11-18.08-43-24.a4e11dac-b0ab-49b8-83b7-105ea1ba5ad2
>>  'ascii' codec can't encode 
>> character u'\xf3' in position 23: ordinal not in range(128) Version  
>> web2py™ Version 2.9.11-stable+timestamp.2014.09.15.23.35.11  Python Python 
>> 2.7.3: /usr/bin/python (prefix: /usr)  Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 224, in restricted
>> exec ccode in environment
>>   File 
>> "/home/www-data/web2py/applications/mp/modules/plugins/feed/feed.rss", line 
>> 12, in 
>> from gluon.serializers import rss
>>   File "/home/www-data/web2py/gluon/serializers.py", line 172, in rss
>> description=safestr(feed,'description'),
>>   File "/home/www-data/web2py/gluon/serializers.py", line 167, in safestr
>> return str(obj[key]).encode('utf-8', 'replace') if key in obj else 
>> default
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 
>> 23: ordinal not in range(128)
>>
>> Error snapshot [image: help] 
>> 
>>  
>>
>> ('ascii' codec can't encode 
>> character u'\xf3' in position 23: ordinal not in range(128)) 
>>
>
> when restore web2py/gluon/serializers.py to version 2.9.5 work fine
>
> My python version is 2.7.3
> will relate to this? 
> https://groups.google.com/forum/#!topic/web2py/8ZwVMKS69Sg
>
> My feed.rss page is:
> dd=dict(title="my feed",
> link=u"feed.example.com",
> description="carácter acentuado".decode('utf-8'),
> entries=[
>   dict(title="my feed",
>   link=u"http://feed.example.com";,
>   description="my first feed")
> ])
> from gluon.serializers import rss   
> response.write(rss(dd), escape=False)
> response.headers['Content-Type']='application/rss+xml'
>
>
> El miércoles, 10 de septiembre de 2014 15:27:07 UTC+2, Massimo Di Pierro 
> escribió:
>>
>> Sorry for the trouble here:
>>
>> I pushed this to trunk:
>> def rss(feed):
>> if not 'entries' in feed and 'items' in feed:
>> feed['entries'] = feed['items']
>> def safestr(obj, key, default=''):
>> return str(obj[key]).encode('utf-8', 'replace') if key in obj 
>> else default
>>
>> now = datetime.datetime.now()
>> rss = rss2.RSS2(title=safestr(feed,'title'),
>> link=safestr(feed,'link'),
>> description=safestr(feed,'description'),
>> lastBuildDate=feed.get('created_on', now),
>> items=[rss2.RSSItem(
>>title=safestr(entry,'title','(notitle)'),
>>link=safestr(entry,'link'),
>>description=safestr(entry,'description'),
>>pubDate=entry.get('created_on', now)
>>) for entry in feed.get('entries', [])])
>> return rss.to_xml(encoding='utf-8')
>>
>> please let me know if this fixes it. If not, please send me more details 
>> about the feed you are trying to read.
>>
>>  
>>
> On Tuesday, 9 September 2014 00:45:25 UTC-5, Капылов Данил wrote:
>>>
>>> Does not work. :-)
>>>
>>> Error ticket for "welcome"Ticket ID
>>>
>>> 127.0.0.1.2014-09-09.11-33-31.6f78e65a-5d28-410e-9111-55ded191b520
>>>  'NoneType' object has no attribute 
>>> 'encode'Версияweb2py™Version 2.9.9-stable+timestamp.2014.09.08.13.16.54
>>> PythonPython 2.7.6: 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\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\restricted.py",
>>>  line 221, in restricted
>>> exec ccode in environment
>>>   File 
>>> "C:\Users\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\applications\welcome\views\generic.rss",
>>>  line 10, in 
>>> from gluon.serializers import rss}}{{=XML(rss(response._vars))}}
>>>   File 
>>> "C:\Users\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\serializers.py",
>>>  line 168, in rss
>>> link=str((feed.get('link') or '').encode('utf-8', 'replace')),
>>> AttributeError: 'NoneType' object has no attribute 'encode'
>>>

[web2py] Re: How do you issue a command to the operating system in web2py?

2014-11-18 Thread Leonel Câmara
This is a very very bad idea, it's also a python question not a web2py one 
(it's possible btw), what are you trying to accomplish?

-- 
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: Convert MongoDB / dict into a DAL Row

2014-11-18 Thread Leonel Câmara
What if you do use limitby in the select to limit the results to just one, 
is there still a performance difference?

-- 
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: Current controller function for Facebook buttons

2014-11-18 Thread Leonel Câmara
URL(args=request.args, vars=request.vars, scheme=True, host=True)

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

2014-11-18 Thread António Ramos
Funding web2py could punch it to the future faster

Meteor did it , why cant web2py get some fundings ?

https://www.meteor.com/blog/2012/07/25/meteors-new-112-million-development-budget

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.


[web2py] Re: PythonAnywhere 405 Not Allowed - response.js problem?

2014-11-18 Thread Niphlod
response.js creates a header. I can only assume that pythonanywhere impose 
a limit on the length of the header. What you're doing is wrong on many 
levels for http specs.

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

2014-11-18 Thread Dragan Matic
Also, file scripts/setup-web2py-centos7.sh is missing from mercurial 
repository. Obviously there is a problem in syncing two repositories. 

On Monday, November 17, 2014 8:25:44 AM UTC+1, Johann Spies wrote:
>
> According to https://code.google.com/p/web2py/source/checkout the 
> Mercurial repository should still  be valid, but it differs from the git 
> repository e.g. the file gluon/dal/adaptors/postgres.py does not appear in 
> the mercurial repository while the problem has been corrected in the git 
> repository:  postgre.py => postgres.py.
>
> If the mercurial repository is no longer to be trusted, then I suppose the 
> information on the abovementioned link should be updated.
>
> Regards
> Johann
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 
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: Deployment script for CentOS: apache + mod_wsgi + msql

2014-11-18 Thread Dragan Matic
for centos6 you should use setup-web2py-fedora.sh, it does the job. 
for centos7 there is setup-web2py-centos7.sh as Massimo mentioned but it 
will not work on centos 6 due to differences is these two systems. 

On Tuesday, November 11, 2014 12:29:34 PM UTC+1, lesssugar wrote:
>
> Hi, guys, I would like to setup web2py on my CentOS 6.6 and I'm looking 
> for deployment script, as I'm no expert.
>
> Apache and MySQL is in place, but I'm looking for relatively painless way 
> to automatically install web2py, configure mod_wsgi etc.
>
> Any help?
>
> *EDIT:*
>
> This looks OK, I guess: 
> http://web2py.googlecode.com/hg/scripts/setup-web2py-fedora.sh
> However, I would like to change the path from */opt/web-apps/ *to 
> */var/www/*. Don't think this could cause problems.
>
> What do you think about the linked script? Seems quite outdated (it was 
> posted on web2pyslices in 2010 if I'm correct).
>

-- 
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: Deployment script for CentOS: apache + mod_wsgi + msql

2014-11-18 Thread lesssugar
Thank you, guys.

I guess the real problem I face is to get web2py working under Apache with 
Parallels Plesk as the control panel.
Plesk is a bit of a black box for my when it comes to configuring it to use 
web2py application as default vhost, instead of using the default Plesk 
vhost.
Unfortunately, there's no script that takes Plesk into consideration 
(which, of course, no one really can be blamed for :))

I had problems with getting web2py to work with Plesk Panel working 
correctly at the same time. Currently, I'm doing it the dirty way: I'm 
running web2py on nginx + uwsgi; Apache runs on a different port to keep 
Plesk working as well. Up until now all seems to be fine.

On Tuesday, November 18, 2014 1:04:43 PM UTC+1, Dragan Matic wrote:
>
> for centos6 you should use setup-web2py-fedora.sh, it does the job. 
> for centos7 there is setup-web2py-centos7.sh as Massimo mentioned but it 
> will not work on centos 6 due to differences is these two systems. 
>
> On Tuesday, November 11, 2014 12:29:34 PM UTC+1, lesssugar wrote:
>>
>> Hi, guys, I would like to setup web2py on my CentOS 6.6 and I'm looking 
>> for deployment script, as I'm no expert.
>>
>> Apache and MySQL is in place, but I'm looking for relatively painless way 
>> to automatically install web2py, configure mod_wsgi etc.
>>
>> Any help?
>>
>> *EDIT:*
>>
>> This looks OK, I guess: 
>> http://web2py.googlecode.com/hg/scripts/setup-web2py-fedora.sh
>> However, I would like to change the path from */opt/web-apps/ *to 
>> */var/www/*. Don't think this could cause problems.
>>
>> What do you think about the linked script? Seems quite outdated (it was 
>> posted on web2pyslices in 2010 if I'm correct).
>>
>

-- 
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: Current controller function for Facebook buttons

2014-11-18 Thread Gael Princivalle
Thanks a lot Leonel.

--
Gael Princivalle

2014-11-18 11:38 GMT+01:00 Leonel Câmara :

> URL(args=request.args, vars=request.vars, scheme=True, host=True)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/K7Xd6R0p8Ps/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: Sending email from server

2014-11-18 Thread Yang
It was caused by selinux. soloved by enabling the httpd_can_sendmail. Thank 
you for all the help! 

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

2014-11-18 Thread Leonel Câmara
I think this would be hard to do. Funding is a lot easier when you're 
riding some kind of hipster wave like meteor did.

-- 
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: Web2py Funding

2014-11-18 Thread Michele Comitini
IMHO funding would be more effective if directed toward a specific feature
or goal, not to the web2py project as a whole.  The latter would require a
kind of political organization that is simply not in place.

2014-11-18 13:40 GMT+01:00 Leonel Câmara :

> I think this would be hard to do. Funding is a lot easier when you're
> riding some kind of hipster wave like meteor did.
>
> --
> 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: read an excel file stored in session using xlrd

2014-11-18 Thread Anthony
First, upload fields do not store the full file path, only the filename 
itself. The file path is obtained from the Field object, which you are not 
persisting in this case because you are using SQLFORM.factory. Also, 
uploads with SQLFORM.factory are tricky because the filename includes the 
database table name, and with a SQLFORM.factory, the default dummy table 
name used is "no_table", which doesn't really exist in the database. 
Finally, the "uploadfolder" argument should be a complete filesystem path 
(e.g., os.path.join(request.folder, 'uploads')).

Anyway, do you really need to save the file, or could you instead just 
directly process the file contents upon upload? If you do need to save the 
file, do you also need a way to clean up old files? If you instead need to 
permanently save the files, then use SQLFORM with a database table rather 
than SQLFORM.factory.

Anthony

On Tuesday, November 18, 2014 1:36:31 AM UTC-5, T.R.Rajkumar wrote:
>
> form_upload = SQLFORM.factory(Field('your_excel_file', 'upload',
> uploadfolder='helloworld/uploads'))
> if form_upload.process().accepted:
> session.your_excel_file = form.vars.your_excel_file
>
> def import_from_excel():
> workbook = xlrd.open_workbook(session.your_excel_file)
>
>
> When import_from_excel() is called gives rise to the below error.
> How to access excel file stored in session? 
>
> File "F:/trr/web2py/web2py/applications/helloworld/controllers/cms_meas.py" 
> ,
>  line 255, in import_from_excel
> workbook = xlrd.open_workbook(session.your_excel_file)
>   File "D:\Python\lib\site-packages\xlrd\__init__.py", line 366, in 
> open_workbook
> formatting_info=formatting_info,
>   File "D:\Python\lib\site-packages\xlrd\__init__.py", line 725, in __init__
> f = open(filename, open_mode)
> TypeError: coercing to Unicode: need string or buffer, NoneType found
>
>
>
>
>

-- 
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: second page to be accessed only from first page

2014-11-18 Thread Anthony
So what is the problem? It sounds like it is working as expected -- with 
the "not session.visitor_name" condition, you get a redirect if no name has 
previously been entered on the first page, correct? Are you observing 
something different? Note, once you have visited the first page, you can 
then visit the second page as many times as you like (because the 
"visitor_name" remains in the session until cleared). If you only want to 
allow a single visit to the second page immediately from the first page, 
then you need to clear the session variable after rendering it in the 
second page view.

Also, note that the "not request.function == 'first'" condition isn't 
actually necessary if that code is inside the second function -- it would 
only be necessary if that code were at the top level of the controller 
(i.e., outside of any function).

Anthony

On Tuesday, November 18, 2014 1:25:22 AM UTC-5, T.R.Rajkumar wrote:
>
> I am able to visit the second page directly without visiting the first 
> page if I have only the request.function. If I add the session var 
> condition then it restricts.
>
> On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote:
>>
>> In book chapter 3 overview the following is given to restrict access to 
>> second page. 
>>
>> if not request.function=='first' and not session.visitor_name:
>> redirect(URL('first'))
>>
>> But if I print request.function it says 'second'.
>> How to restrict access to second page only from first page?
>>
>>
>>

-- 
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] Passing request.arg variables to .load components on the same page

2014-11-18 Thread Stephen McCamy
Hello,

We have a web2py application that loads results from a database and 
navigates/displays the results by passing the primary key in the URL and 
reading the number using request.args.  For example, below would display 
record number 1500 in the DB.  If you clink the navigation tab below it it 
will pass you on to the next record, 1501.  

https://x.x.x:8081/app/controller/view/1500

The app looks similar to webmail or outlook with the record IDs on the left 
and other content for that record on the right hand block.  We want to be 
able to poll individual parts of the page, say the navigation side to 
update with new records.  The issue I am having is when you seperate the 
page components into separate .load files all of the request.args functions 
are of course broken.  I think there is a way to solve this but I just do 
not understand it well enough to know where to start.  

I may be going about this all wrong and wanted some input. .

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] Re: a proposal for form improvement

2014-11-18 Thread Richard Vézina
I miss this one...

How does JForm will cohabit with Angularjs or Ractivejs?

Richard

On Mon, Nov 17, 2014 at 11:56 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> In my todo list but no great progress yet.
>
>
> On Friday, 14 November 2014 05:58:10 UTC-6, Ramos wrote:
>>
>> Just checking the status of Jform.
>> Any news on it?
>>
>> Regards
>> António
>>
>> 2014-09-10 2:02 GMT+01:00 Massimo Di Pierro :
>>
>>> I agree. I have not implemented but I was planning to add this feature.
>>>
>>> On Tuesday, 9 September 2014 03:44:30 UTC-5, Leonel Câmara wrote:

 This is the corresponding JS one optimized for bootstrap 3:
>
> jform.widgets['text'] = function(field) { return
> jform.tag('textarea',{'name':field.name,'class':'form-contro
> l'})(field.value); }
>

 Massimo that looks good, however in SQLFORM I can change the textwidget
 in a very specific way - I can change it for a single field on a single
 table on a single controller, changing widgets in jform like this wouldn't
 work because you would change the text widget for all jforms being rendered
 in that webpage.

 Maybe you want to change the widget for just that one form and leave
 the others unchanged. Sometimes, you do want to change your textwidgets
 application wide but sometimes you don't. So things get a little more
 complicated.

 There needs to be some way to define context for jform where you can
 customize just one single form. Basically JForm would need to have a
 dictionary of table or even form specific widgets where you could do
 something like.

 jform.widgets.forms[myformid]['text'] = function(field) { return
 jform.tag('textarea',{'name':field.name,'class':'form-contro
 l'})(field.value); }
 jform.widgets.tables[tablename]['text'] = function(field) { return
 jform.tag('textarea',{'name':field.name,'class':'form-contro
 l'})(field.value); }

 So things do start to get messy. This solution, of course, isn't ideal
 if you are building a single page app as this context you're creating
 doesn't get automatically cleaned every call like it happens on the server
 side with SQLFORM so then you start to get strange interactions and bugs.
 Hence we have to figure out a smarter way to do it where the context is
 really available for just that one form and it goes away with 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.
>>>
>>
>>  --
> 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: Passing request.arg variables to .load components on the same page

2014-11-18 Thread Leonel Câmara
You can pass args to LOAD the same way you pass them to URL. You probably 
want something like LOAD('controllerfile', 'function', args=request.args)

-- 
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: Passing request.arg variables to .load components on the same page

2014-11-18 Thread Stephen McCamy
That was it.  Thanks!  

On Tuesday, November 18, 2014 10:17:45 AM UTC-5, Leonel Câmara wrote:
>
> You can pass args to LOAD the same way you pass them to URL. You probably 
> want something like LOAD('controllerfile', 'function', args=request.args)
>

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

2014-11-18 Thread lyn2py
I think a lot has to do with the culture. Notice in Meteor there is a very 
commercial culture about it. In web2py it's a family of giving and sharing. 
At least that's how I perceive it. I feel more comfortable here.

On Tuesday, November 18, 2014 7:15:04 PM UTC+8, Ramos wrote:
>
> Funding web2py could punch it to the future faster
>
> Meteor did it , why cant web2py get some fundings ?
>
>
> https://www.meteor.com/blog/2012/07/25/meteors-new-112-million-development-budget
>
> 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.


[web2py] in grid, can "fields" argument name virtual fields?

2014-11-18 Thread Alex Glaros
in grid, can fields argument name virtual fields?

Or can it only use fields from the table?

If it can, what is the format? How would it identify the virtual fields?

I ask because am seeking granular control over column order. If all "links" 
through the placement argument are on "left", then table fields column 
order cannot intermingle with links fieldsit's all or nothing.  But if 
fields argument can use virtual fields, then granular control over column 
order is possible regardless of whether it's a table or virtual field.  

Otherwise, the only option for granular control is to make all columns 
including table fields, links, thereby losing the built-in grid column sort 
capacity.

thanks

Alex Glaros

-- 
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] Packed application changes

2014-11-18 Thread Gael Princivalle
Hello all.

Well I've got a strange problem.
I've got an app in my web2py application.
I do a package of my app.
I upload my app package in the same web2py application.
So I expect that the application will be the same, but it's not.

Containers width are something like 50 pixel smaller.
I've tried to susbstitute all css and js files, I've got always the same 
error.
Firefox CSS inspector don't show any difference.

Chrome don't do this problem. 

Someone knows why ?

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.


[web2py] Re: in grid, can "fields" argument name virtual fields?

2014-11-18 Thread Anthony
On Tuesday, November 18, 2014 11:42:35 AM UTC-5, Alex Glaros wrote:
>
> in grid, can fields argument name virtual fields?
>

Have you tried it? Sometimes its easier to just try something then to post 
a question about it. ;-)

Anyway, this is covered in the book: 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Virtual-fields-in-SQLFORM-grid-and-smartgrid
 

> I ask because am seeking granular control over column order. If all 
> "links" through the placement argument are on "left", then table fields 
> column order cannot intermingle with links fieldsit's all or nothing. 
>  But if fields argument can use virtual fields, then granular control over 
> column order is possible regardless of whether it's a table or virtual 
> field.  
>
> Otherwise, the only option for granular control is to make all columns 
> including table fields, links, thereby losing the built-in grid column sort 
> capacity.
>

In either case, you won't be able to sort (i.e., you can't sort on virtual 
fields because sorting is done by the database). If you need to sort on a 
calculated field, you're better off using a computed field.

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: Packed application changes

2014-11-18 Thread Leonel Câmara
Maybe, in the original, you zoomed in and firefox saved your preferences?

-- 
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: in grid, can "fields" argument name virtual fields?

2014-11-18 Thread Alex Glaros
when I tried it, didn't know how to identify the field

did not see specific answer in the book

correct, about virtual fields not being sortable, but when I move table 
fields to links argument, they lose their sortability

can you please post syntax if fields argument can use virtual fields?

thanks,

Alex


-- 
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: PythonAnywhere 405 Not Allowed - response.js problem?

2014-11-18 Thread Rob0
Thanks Niphlod.  

I realize this solution was probably using the response.js in a manner for 
which it wasn't intended.

I took the idea from 
http://stackoverflow.com/questions/20633959/ajax-response-in-web2py
I guess that's not the right approach - or perhaps I deviated from the idea.

Is there a better approach which lets you have two ajax components, one for 
the form and one for the results?

If not I can redesign it like I did previously and make the form a non-ajax 
component.



On Tuesday, November 18, 2014 6:35:10 AM UTC-5, Niphlod wrote:
>
> response.js creates a header. I can only assume that pythonanywhere impose 
> a limit on the length of the header. What you're doing is wrong on many 
> levels for http specs.
>

-- 
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: in grid, can "fields" argument name virtual fields?

2014-11-18 Thread Anthony
On Tuesday, November 18, 2014 12:50:29 PM UTC-5, Alex Glaros wrote:
>
> when I tried it, didn't know how to identify the field
>
> did not see specific answer in the book
>

Same as any field: db.mytable.myfield.
 

> correct, about virtual fields not being sortable, but when I move table 
> fields to links argument, they lose their sortability
>

Yes, because sorting is handled by the database, you cannot sort on virtual 
field columns or "links" columns (which may contain any arbitrary HTML).

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.


Re: [web2py] SQLFORM.grid custom search where is the error?

2014-11-18 Thread Prasad Muley

This problem still exist in web2py 2.9.6.

I've tried to use custom grid search But It is showing me "invalid query" 
near grid.


On Thursday, February 21, 2013 10:09:33 PM UTC+5:30, Mandar Vaze wrote:
>
> I'm using Version "2.3.2 (2012-12-17 15:03:30) stable" and the problem 
> still persists. i.e. I'm still getting "Invalid Query" error.
>
> I'm using Alex's workaround which seems to be working. Thanks Alex.
>
> -Mandar
>
> On Friday, September 28, 2012 6:07:13 PM UTC+5:30, Massimo Di Pierro wrote:
>>
>> Clearly something is wrong I will try this today. Before I do, could you 
>> check the latest trunk?
>>
>> On Friday, 28 September 2012 04:36:26 UTC-5, alex wrote:
>>>
>>> Thank you Johann, of course I did already,
>>>
>>> The query itself gets translated correctly. 
>>> I think that something very subtle is happening when I pass 
>>> search_widget=search_form, and I cannot catch it
>>>
>>> I uploaded here 
>>>  the 
>>> packed version maybe it is easier to understand what happens.
>>> Thank you anyway.
>>> Alex
>>>
>>>
>>> On Friday, September 28, 2012 3:45:25 PM UTC+9, Johann Spies wrote:

 On 28 September 2012 07:15, alex  wrote:

>
> What am I doing wrong?
>

 A good way to learn this query syntax is to build the query from the 
 dropdownbox which you get when you click in the search box.   

 Regards
 Johann

 -- 
 Because experiencing your loyal love is better than life itself, 
 my lips will praise you.  (Psalm 63:3)



-- 
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: Packed application changes

2014-11-18 Thread Gael Princivalle
a you're right ! I've made some confusion, good dimension was
with the app on my production web2py application.
All production app were with a 90 % zoom.
My apologize for the disturb.

Thanks.

--
Gael Princivalle

2014-11-18 18:19 GMT+01:00 Leonel Câmara :

> Maybe, in the original, you zoomed in and firefox saved your preferences?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/XmsuIn0hDwo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: PythonAnywhere 405 Not Allowed - response.js problem?

2014-11-18 Thread Anthony
On Tuesday, November 18, 2014 1:41:18 PM UTC-5, Rob0 wrote:
>
> Thanks Niphlod.  
>
> I realize this solution was probably using the response.js in a manner for 
> which it wasn't intended.
>
> I took the idea from 
> http://stackoverflow.com/questions/20633959/ajax-response-in-web2py
> I guess that's not the right approach - or perhaps I deviated from the 
> idea.
>
> Is there a better approach which lets you have two ajax components, one 
> for the form and one for the results?
>

Actually, the better approach is in the very Stack Overflow answer that you 
referenced. That answer does not do what you did (i.e., return the entire 
grid via response.js), but instead includes two separate components and 
uses response.js to issue a one-line command that updates the second 
component whenever the first component submits a form.

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: PythonAnywhere 405 Not Allowed - response.js problem?

2014-11-18 Thread Rob0
Right.  Looks like I oversimplified the (your?) approach.
Thanks for the quick reply Anthony, I appreciate it.

On Tuesday, November 18, 2014 2:39:37 PM UTC-5, Anthony wrote:
>
> On Tuesday, November 18, 2014 1:41:18 PM UTC-5, Rob0 wrote:
>>
>> Thanks Niphlod.  
>>
>> I realize this solution was probably using the response.js in a manner 
>> for which it wasn't intended.
>>
>> I took the idea from 
>> http://stackoverflow.com/questions/20633959/ajax-response-in-web2py
>> I guess that's not the right approach - or perhaps I deviated from the 
>> idea.
>>
>> Is there a better approach which lets you have two ajax components, one 
>> for the form and one for the results?
>>
>
> Actually, the better approach is in the very Stack Overflow answer that 
> you referenced. That answer does not do what you did (i.e., return the 
> entire grid via response.js), but instead includes two separate components 
> and uses response.js to issue a one-line command that updates the second 
> component whenever the first component submits a form.
>
> 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: Mercurial?

2014-11-18 Thread Dave S


On Tuesday, November 18, 2014 4:02:17 AM UTC-8, Dragan Matic wrote:
>
> Also, file scripts/setup-web2py-centos7.sh is missing from mercurial 
> repository. Obviously there is a problem in syncing two repositories. 
>
>
Mercurial has pretty good tools for syncing repositories of various forms, 
which could be run in pull mode, but perhaps the hosting sites add their 
own wrinkles to the process.

/dps


On Monday, November 17, 2014 8:25:44 AM UTC+1, Johann Spies wrote:
>>
>> According to https://code.google.com/p/web2py/source/checkout the 
>> Mercurial repository should still  be valid, but it differs from the git 
>> repository e.g. the file gluon/dal/adaptors/postgres.py does not appear in 
>> the mercurial repository while the problem has been corrected in the git 
>> repository:  postgre.py => postgres.py.
>>
>> If the mercurial repository is no longer to be trusted, then I suppose 
>> the information on the abovementioned link should be updated.
>>
>  

-- 
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] Starting to shed my newbie skin

2014-11-18 Thread Dave S
I actually used a Form!

I have a very simple web site.  Originally it had one page beyond the 
(sample) index.html, which just did a query of my db based on the current 
date.

Now I have 2 more pages, one of which allows entries from 
your-choice-of-month to be listed, and one which allows listing based on 
matching a surname.
(Happy Birthday, Carl Maria von Weber!)

My controller isn't very sophisticated ... I use a FORM to get the search 
"term" from the user, and if it validates I do the query and return the 
rows with the form;
return dict(form = form, rows=rows)
The page doesn't redirect, although I have regular A's to link the 3 pages 
together.

Not much to crow about, but it certainly feels like progress!

/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: web2py: RESTful API returns "invalid arguments" for any POST request with JSON body

2014-11-18 Thread Tomáš Slobodník
Ok, I tried to install Python 2.7.8 in my home directory on production 
server and error disappeared. Then I tried the same with Python 2.6.8 with 
same result - no error. Don't know what caused the error but my guess is 
some bug in Python 2.6.1.

Dne středa, 5. listopadu 2014 23:37:03 UTC+1 Niphlod napsal(a):
>
> whoops, don't mind. I think it's this 
> 
>  
> commit that I remember, but that was back when we had 2.5 support
>
> On Wednesday, November 5, 2014 11:27:40 PM UTC+1, Niphlod wrote:
>>
>> uuhm, I remember something going weird with python 2.6 unpacking args and 
>> kwargs, but I really don't remember the specifics... some syntax worked 
>> in 2.6 and 2.7 while another only in 2.7
>>
>> On Wednesday, November 5, 2014 11:12:11 PM UTC+1, Leonel Câmara wrote:
>>>
>>> Then I would guess it's some problem with your webserver configuration 
>>> as there's nothing in Request.restful that wouldn't work with python 2.6 
>>> (although seriously 2.7 has been out for 4 years already).
>>>
>>> Have you tried without using https?
>>>
>>

-- 
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: Starting to shed my newbie skin

2014-11-18 Thread Dave S


On Tuesday, November 18, 2014 11:56:59 AM UTC-8, Dave S wrote:
>
> I actually used a Form!
>
> I have a very simple web site.  Originally it had one page beyond the 
> (sample) index.html, which just did a query of my db based on the current 
> date.
>
> Now I have 2 more pages, one of which allows entries from 
> your-choice-of-month to be listed,
>

The DAL's datetime.month() function makes this easy, but when I was trying 
to preview the results in the sqlite3 console, I couldn't get anything 
using their strft("%m", ...), so I still have room to grow.   ;-)

/dps

 

> and one which allows listing based on matching a surname.
> (Happy Birthday, Carl Maria von Weber!)
>
> My controller isn't very sophisticated ... I use a FORM to get the search 
> "term" from the user, and if it validates I do the query and return the 
> rows with the form;
> return dict(form = form, rows=rows)
> The page doesn't redirect, although I have regular A's to link the 3 pages 
> together.
>
> Not much to crow about, but it certainly feels like progress!
>
> /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] Using two words in html helpers

2014-11-18 Thread LoveWeb2py
How can I have two words in the html helper?

For example



I'm trying to use tags and have tried using TAG.audio(str('content here'), 
_autoplay) but it treats autoplay as a variable at that point. When I try 
to set autoplay as a string it doesn't work.

Any thoughts?

-- 
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 two words in html helpers

2014-11-18 Thread LoveWeb2py
Figured it out... sorry for the trouble. Here is the solution

TAG['audio autoplay']

If you use the dictionary format you can combine multiple values (as 
mentioned in the book)

Thanks!!


On Tuesday, November 18, 2014 5:57:44 PM UTC-5, LoveWeb2py wrote:
>
> How can I have two words in the html helper?
>
> For example
>
> 
>
> I'm trying to use tags and have tried using TAG.audio(str('content here'), 
> _autoplay) but it treats autoplay as a variable at that point. When I try 
> to set autoplay as a string it doesn't work.
>
> Any thoughts?
>

-- 
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: play audio file from controller

2014-11-18 Thread LoveWeb2py
Thanks, Massimo!

In my controller am I right in thinking I can have something like this:

def soundControl():
sound = db().select(db.sounds.ALL)
query = db(db.sounds.id>0).select().first()
AudioFile = db.sounds.filename.retrieve(query.filename)[1]
soundToPlay = TAG['audio autoplay'](TAG.source(_src=AudioFile))
return dict(sound=soundToPlay)

view:
{{=sound}}

This is what my HTML looks like and its not working:

http://127.0.0.1:8000/uct6/board/%3Copen%20file%20'C://web2py_src//web2py//applications//uct6//databases//uploads//sounds.filename.a503ee3bea631f2e.646f6d696e6174696e672e776176.wav',%20mode%20'rb'%20at%200x09F00C90%3E>
">'

I'm guessing I need to perform one additional step to reference the actual 
file name in the database? 


On Monday, November 17, 2014 11:45:59 PM UTC-5, Massimo Di Pierro wrote:
>
> there is a function db.mytable.myfield.retrieve(row.myfield)
>
>
> On Monday, 10 November 2014 10:51:53 UTC-6, LoveWeb2py wrote:
>>
>> Here is the code in the link:
>> db.define_table('music', Field('name',required=True), 
>> Field('filename','upload',required=True), auth.signature) " > 
>> applications/audio/models/db_audio.py echo " response.menu = 
>> [('Home',0,URL('index'))] # allows to browser, search, and upload new music 
>> (if logged in) def index(): # tell web2py that links to music files are to 
>> be # represented as HTML5 audio embedded players from 
>> gluon.contrib.autolinks import expand_one db.music.filename.represent = 
>> lambda v,r: \ XML(expand_one(URL('download',args=v),{})) return dict(grid = 
>> SQLFORM.grid(db.music)) # perform login/logout/registration/etc. def 
>> user(): return dict(form=auth()) # allow streaming of all files, including 
>> partial content of music files @cache.action() def download(): return 
>> response.download(request, db) " > 
>> applications/audio/controllers/default.py 
>> After a file is uploaded into the DB. How could I access it via a view or 
>> controller? I tried using the dal, but it doesn't seem to work. Does my 
>> question make sense?
>>
>> On Wednesday, November 5, 2014 11:19:17 PM UTC-5, LoveWeb2py wrote:
>>>
>>> *Hello,*
>>>
>>> *I'd like to play an audio file in my view once a certain condition is 
>>> met.*
>>>
>>> *I'm using Massimo's audio setup (thank you, Massimo!!) found here:*
>>>
>>> *https://www.reddit.com/r/Python/comments/1r7v23/audio_streaming_app_in_web2py_from_scratch/
>>>  
>>> *
>>>
>>> *How could I stream/play the audio from the database where I uploaded 
>>> the files. I would post my model/controller but its all in the link above.*
>>>
>>

-- 
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: play audio file from controller

2014-11-18 Thread LoveWeb2py
Quick update: When I type AudioFile.name it brings back the path, but it 
exposes the full path. There has to be a better way? I hope?

On Tuesday, November 18, 2014 6:55:40 PM UTC-5, LoveWeb2py wrote:
>
> Thanks, Massimo!
>
> In my controller am I right in thinking I can have something like this:
>
> def soundControl():
> sound = db().select(db.sounds.ALL)
> query = db(db.sounds.id>0).select().first()
> AudioFile = db.sounds.filename.retrieve(query.filename)[1]
> soundToPlay = TAG['audio autoplay'](TAG.source(_src=AudioFile))
> return dict(sound=soundToPlay)
>
> view:
> {{=sound}}
>
> This is what my HTML looks like and its not working:
>
> http://127.0.0.1:8000/uct6/board/%3Copen%20file%20'C://web2py_src//web2py//applications//uct6//databases//uploads//sounds.filename.a503ee3bea631f2e.646f6d696e6174696e672e776176.wav',%20mode%20'rb'%20at%200x09F00C90%3E>
> ">'
>
> I'm guessing I need to perform one additional step to reference the actual 
> file name in the database? 
>
>
> On Monday, November 17, 2014 11:45:59 PM UTC-5, Massimo Di Pierro wrote:
>>
>> there is a function db.mytable.myfield.retrieve(row.myfield)
>>
>>
>> On Monday, 10 November 2014 10:51:53 UTC-6, LoveWeb2py wrote:
>>>
>>> Here is the code in the link:
>>> db.define_table('music', Field('name',required=True), 
>>> Field('filename','upload',required=True), auth.signature) " > 
>>> applications/audio/models/db_audio.py echo " response.menu = 
>>> [('Home',0,URL('index'))] # allows to browser, search, and upload new music 
>>> (if logged in) def index(): # tell web2py that links to music files are to 
>>> be # represented as HTML5 audio embedded players from 
>>> gluon.contrib.autolinks import expand_one db.music.filename.represent = 
>>> lambda v,r: \ XML(expand_one(URL('download',args=v),{})) return dict(grid = 
>>> SQLFORM.grid(db.music)) # perform login/logout/registration/etc. def 
>>> user(): return dict(form=auth()) # allow streaming of all files, including 
>>> partial content of music files @cache.action() def download(): return 
>>> response.download(request, db) " > 
>>> applications/audio/controllers/default.py 
>>> After a file is uploaded into the DB. How could I access it via a view 
>>> or controller? I tried using the dal, but it doesn't seem to work. Does my 
>>> question make sense?
>>>
>>> On Wednesday, November 5, 2014 11:19:17 PM UTC-5, LoveWeb2py wrote:

 *Hello,*

 *I'd like to play an audio file in my view once a certain condition is 
 met.*

 *I'm using Massimo's audio setup (thank you, Massimo!!) found here:*

 *https://www.reddit.com/r/Python/comments/1r7v23/audio_streaming_app_in_web2py_from_scratch/
  
 *

 *How could I stream/play the audio from the database where I uploaded 
 the files. I would post my model/controller but its all in the link above.*

>>>

-- 
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 two words in html helpers

2014-11-18 Thread Leonel Câmara
No no, don't do this, then it will close with  which is 
not what you want, there are no HTML tags with two 
words. TAG.audio(_autoplay='autoplay') is ok and will work. Autoplay is an 
attribute, the reason you can use it without a value is because HTML allows 
attribute minimization. If the value there annoys you, you can 
use XML(''), or just don't use a helper.

-- 
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: play audio file from controller

2014-11-18 Thread LoveWeb2py
Figured it out following this 
thread: 
https://groups.google.com/forum/#!searchin/web2py/response.download/web2py/KLK9i_7eNOc/BXTrCefrUtoJ

Had to set args = to my db query.filename

Thank you!

On Wednesday, November 5, 2014 11:19:17 PM UTC-5, LoveWeb2py wrote:
>
> *Hello,*
>
> *I'd like to play an audio file in my view once a certain condition is 
> met.*
>
> *I'm using Massimo's audio setup (thank you, Massimo!!) found here:*
>
> *https://www.reddit.com/r/Python/comments/1r7v23/audio_streaming_app_in_web2py_from_scratch/
>  
> *
>
> *How could I stream/play the audio from the database where I uploaded the 
> files. I would post my model/controller but its all in the link above.*
>

-- 
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] SQLFORM.grid edit only selects the first record and updates all records.

2014-11-18 Thread Stephen McCamy
Hello,

I am having an issue with SQLFORM.grid where when there are more than one 
records returned the edit button only shows data for the first record.  If 
I do update it then updates all the records with the new values.  I can't 
seem to figure out why.

Here is my db definition:

db.define_table('Correlation',Field('IncidentID','id',label='Event 
ID'),Field('Type',represent=lambda r, row: 
db.CorrelationType[r].CorrelationType),Field('Value'),Field('Context',represent=lambda
 
r, row:A('View',_href=(r),_target='new') if row.Type==4 else r))
db.define_table('CorrelationType',Field('P_Id','id'),Field('CorrelationType'))

Here is the SQLFORM.grid:

corq=db.Correlation.id==(request.args(0))

cor=SQLFORM.grid(query=corq,fields=[db.Correlation.Type,db.Correlation.Value,db.Correlation.Context],links=urllinks,searchable=True,maxtextlength=100,details=True,
 
editable=True,deletable=False,user_signature=False,create=True,links_in_grid=True,args=[request.args[0]],csv=True,exportclasses=dict(
csv_with_hidden_cols=False,
xml=False,
html=False,
json=False,
tsv_with_hidden_cols=False,
tsv=False))

-- 
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: second page to be accessed only from first page

2014-11-18 Thread T.R.Rajkumar
@Anthony Yes the session var is OK. But I would like to see that the second 
page can be visited only after the first page. Keeping the session var 
flags can be troublesome if we have hundreds of pages and the same session 
var gets set in some other page. Is their a way out? The request.function 
seems to be perfect if it stores the first page even inside the second 
action.

On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote:
>
> In book chapter 3 overview the following is given to restrict access to 
> second page. 
>
> if not request.function=='first' and not session.visitor_name:
> redirect(URL('first'))
>
> But if I print request.function it says 'second'.
> How to restrict access to second page only from first page?
>
>
>

-- 
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: read an excel file stored in session using xlrd

2014-11-18 Thread T.R.Rajkumar
@Anthony Thanks for your kind reply. I don't need to save the file. That's 
why w/o db, session becomes handy. I upload the file in master data page 
having two forms. One form is the SQLFORM.factory for uploading the excel 
file and the other form is to enter the key parameters. When the second 
form is submitted this page redirects to another details page where I would 
like to read the excel file uploaded in the first page and populate the 
html table in the details page. Yes I would like to discard the excel file 
upon reading it. Seeking your valuable guidance.

On Tuesday, November 18, 2014 12:06:31 PM UTC+5:30, T.R.Rajkumar wrote:
>
> form_upload = SQLFORM.factory(Field('your_excel_file', 'upload',
> uploadfolder='helloworld/uploads'))
> if form_upload.process().accepted:
> session.your_excel_file = form.vars.your_excel_file
>
> def import_from_excel():
> workbook = xlrd.open_workbook(session.your_excel_file)
>
>
> When import_from_excel() is called gives rise to the below error.
> How to access excel file stored in session? 
>
> File "F:/trr/web2py/web2py/applications/helloworld/controllers/cms_meas.py" 
> ,
>  line 255, in import_from_excel
> workbook = xlrd.open_workbook(session.your_excel_file)
>   File "D:\Python\lib\site-packages\xlrd\__init__.py", line 366, in 
> open_workbook
> formatting_info=formatting_info,
>   File "D:\Python\lib\site-packages\xlrd\__init__.py", line 725, in __init__
> f = open(filename, open_mode)
> TypeError: coercing to Unicode: need string or buffer, NoneType found
>
>
>
>
>

-- 
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] Migrating only a single auth table ?

2014-11-18 Thread Chris Baron
I am trying to add columns to auth_group, but the migration breaks here :

auth.define_tables(username=False, signature=False, migrate=True)

It tries to migrate auth_user first, and fails because it already exists. 
 How do I migrate only the auth_group table ?

-- 
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] All request forwarded to https - How to stop this

2014-11-18 Thread sabbir
OS - Ubantu 12.4
Deployed using deployment script on the book

While browsing apps all the request are forwarding to *https :( *
How can i stop this. 

ideally users who browse with http should be able to browse as it is. 

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.