Re: [web2py] Two components + two forms

2012-12-02 Thread David Sorrentino
Ok Massimo, changing *formname* was the solution. Now everything works.
Thanks one more time for your help. ;)

I wish you a good Monday,
David


On 2 December 2012 09:00, David Sorrentino  wrote:

> Hello Massimo and thanks for your reply.
> The two components point to a different action but I just noticed that
> they have the same formname. :)
> Thank you very much. I'll change the formname of the second and I'll let
> you know.
>
> Have a good day,
> David
>
>
>
> On 1 December 2012 22:50, Massimo Di Pierro wrote:
>
>> Do the two components point to the same action, or do they contain forms
>> with same formname? Either case that would not work because multiple forms
>> in the same page must have different formnames?
>>
>>
>> On Saturday, 1 December 2012 13:32:48 UTC-6, David Sorrentino wrote:
>>>
>>> Hello everybody,
>>>
>>> I'm struggling for a while with a problem.
>>> I have a page with two components. Each component contains a form.
>>> I embedded both the components with LOAD. Unfortunately when I submit
>>> one of the two forms, all the values are deleted and apparently there is no
>>> submission. If then I submit that form a second time, it seems to work.
>>> The problem is for sure related to the presence of two components, since
>>> if I embed just one of them everything works fine.
>>>
>>> Am I missing something?
>>>
>>> Cheers,
>>> David
>>>
>>  --
>>
>>
>>
>>
>
>

-- 





Re: [web2py] Two components + two forms

2012-12-02 Thread David Sorrentino
Hello Massimo and thanks for your reply.
The two components point to a different action but I just noticed that they
have the same formname. :)
Thank you very much. I'll change the formname of the second and I'll let
you know.

Have a good day,
David


On 1 December 2012 22:50, Massimo Di Pierro wrote:

> Do the two components point to the same action, or do they contain forms
> with same formname? Either case that would not work because multiple forms
> in the same page must have different formnames?
>
>
> On Saturday, 1 December 2012 13:32:48 UTC-6, David Sorrentino wrote:
>>
>> Hello everybody,
>>
>> I'm struggling for a while with a problem.
>> I have a page with two components. Each component contains a form.
>> I embedded both the components with LOAD. Unfortunately when I submit one
>> of the two forms, all the values are deleted and apparently there is no
>> submission. If then I submit that form a second time, it seems to work.
>> The problem is for sure related to the presence of two components, since
>> if I embed just one of them everything works fine.
>>
>> Am I missing something?
>>
>> Cheers,
>> David
>>
>  --
>
>
>
>

-- 





[web2py] Two components + two forms

2012-12-01 Thread David Sorrentino
Hello everybody,

I'm struggling for a while with a problem.
I have a page with two components. Each component contains a form.
I embedded both the components with LOAD. Unfortunately when I submit one
of the two forms, all the values are deleted and apparently there is no
submission. If then I submit that form a second time, it seems to work.
The problem is for sure related to the presence of two components, since if
I embed just one of them everything works fine.

Am I missing something?

Cheers,
David

-- 





Re: [web2py] Re: Choosing the PDF file's name with appreport PISA

2012-11-19 Thread David Sorrentino
Mandar,

Thank you very much. I downloaded the version 0.1.x and it perfectly works.
I didn't think that wiki page could have pointed to an old version of the
plugin.

I wish you a wondeful day,
David


On 19 November 2012 11:28, Mandar Vaze  wrote:

> David,
> When I downloaded the 0.1.x version from Downloads section, the
> response_filename param works. Hope this helps.
>
> Lucas,
> https://github.com/lucasdavila/web2py-appreport/wiki page points to older
> w2p file, which is an year old.
> May be you should update the documentation to point to 0.1.x version.
>
> -Mandar
>
>
> On Monday, November 19, 2012 2:24:07 PM UTC+5:30, Mandar Vaze wrote:
>>
>> Same here. I downloaded the w2p on Nov 12th - so I think I have the
>> latest version. But the filename seems to be ignored.
>> I'm using web2py 2.0.9
>>
>> On Monday, November 12, 2012 1:26:53 PM UTC+5:30, David Sorrentino wrote:
>>>
>>> Hello everybody! :)
>>>
>>> I am using appreport with the PISA engine in order to export a view to a
>>> PDF file and I would like to choose the name of the PDF file generated.
>>> The view is the following one:
>>> results = dict(success=True)
>>> html = response.render('default/**results.html', results)
>>> return plugin_appreport.REPORTPISA(ht**ml = html, response_filename =
>>> 'change_my_name.pdf')
>>>
>>> As you can see, I used the parameter *response_filename* for setting a
>>> custom name, but it doesn't seem to work.
>>> Any suggestions?
>>>
>>> Cheers,
>>> David
>>>
>>  --
>
>
>
>

-- 





Re: [web2py] Multilanguage website

2012-11-17 Thread David Sorrentino
Dear Niphlod,

This is right what I was looking for! :D
It's unbelievable how much I still have to learn about web2py. :)

Thanks a lot for this solution Niphlod!

Wish you a nice evening.
David


On 16 November 2012 21:36, Niphlod  wrote:

> ok, I played with it and understood an "underlying design" decision to let
> the current request.uri_language to propagate to all URL() generated links.
> In fact, parameter based router was thought to let "different" versions of
> the same site to behave in a consistent way (i.e., if you accessed
> myapp/it/something, it's likely that you'd like to navigate the entire site
> from there "mapped" to the it language).
>
> In this case, generating(showing) an url containing a different language
> is "forbidden" by the URL syntax but can be easily managedjust not
> using the URL() function :P
>
> You can use some replace with request.env.path_info, but I found a nicer
> method: you can in fact "alter" the language mapping of the URL just
> (re)setting the request.uri_language variable.
> I mean:
> /myapp/it/default/index
> URL('something', 'else') --> /myapp/it/something/else
> but:
> /myapp/it/default/index
> request.uri_language = 'jp'
> URL('something', 'else') --> /myapp/jp/something/else
>
> My advice would be to save the "actual" request.uri_language in some
> variable and altering that just to generate the URLs, then reset it back to
> the original value (so static and other links won't be 'altered', and you
> get the shortest possible link, etc etc)  e.g.
>
> def index():
> orig_lang = request.uri_lang
> request.uri_lang = 'en'
> this_page_in_eng_url = URL()
> request.uri_lang = 'it'
> this_page_in_it_url = URL()
> request.uri_lang = orig_lang
> return dict()
>
>
>
>
>
>
>
>
> On Friday, November 16, 2012 8:33:34 PM UTC+1, David Sorrentino wrote:
>
>> Niphlod,
>>
>> I understand that web2py expects something like /a/lang/c/f or /lang/c/f,
>> but playing with request.something I didn't manage to obtain that. :)
>> Any tips?
>> Thanks for your help.
>>
>> Have a good night.
>> David
>>
>>
>> On 16 November 2012 15:25, Niphlod  wrote:
>>
>>> URL('it') is "go to the "it" function in the same controller I'm in".
>>> haven't played with that, but I guess web2py expects something like
>>> /a/lang/c/f so, by some means of request.something
>>> (function,controller,args,etc) you should be able to.
>>>
>>>
>>>
>>> On Friday, November 16, 2012 12:23:52 PM UTC+1, David Sorrentino wrote:
>>>
>>>> Very last doubt, I promise! :P
>>>>
>>>> Let us assume that I am visiting the page at this url:
>>>>
>>>> /en/portfolio
>>>>>
>>>>
>>>> and I want to change to /it/portfolio, how can I set URL in order to do
>>>> that?
>>>> If I set it like this:
>>>>
>>>> URL('it')
>>>>>
>>>>
>>>> I will obtain:
>>>>
>>>> /en/it
>>>>>
>>>>
>>>> which is an invalid function.
>>>>
>>>> Cheers,
>>>> David
>>>>
>>>>
>>>> On 16 November 2012 11:33, David Sorrentino wrote:
>>>>
>>>>> Hi Niphlod,
>>>>>
>>>>> Thanks for your example. It's crystal clear. ;)
>>>>> I got another doubt about multi-languages: on the online book I read
>>>>> that in order to tell web2py which language is the default one, I have to
>>>>> use:
>>>>>
>>>>> T.set_current_languages('it')
>>>>>>
>>>>>
>>>>> Now I am wondering if I need to use it in the controller and call it
>>>>> every time I load a page, or I can put it somewhere else and tell web2py
>>>>> just once which one is the default language.
>>>>>
>>>>> Sorry for all these doubts! :P
>>>>>
>>>>> Cheers,
>>>>> David
>>>>>
>>>>>
>>>>>
>>>>> On 15 November 2012 21:46, Niphlod  wrote:
>>>>>
>>>>>> I'd do the following
>>>>>> 1. choose a storage option for your content (you may want to use a
>>>>>> simple table with a 'text' field for editing online, or code something to
>>>>>> save the content to a "txt" file)
>>>>>> 2. code something that inspects the uri_language and does
>>>>>> (semi-programming-language):
>>>>>> if exists "nameoftherequestedarticle":
>>>>>>   if uri_language in "translationsofthearticle":
>>>>>>   content = translatedarticle
>>>>>>   else:
>>>>>>   content = originalarticle (english ?)
>>>>>> else:
>>>>>> raise 404
>>>>>>
>>>>>>  --
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread David Sorrentino
Niphlod,

I understand that web2py expects something like /a/lang/c/f or /lang/c/f,
but playing with request.something I didn't manage to obtain that. :)
Any tips?
Thanks for your help.

Have a good night.
David


On 16 November 2012 15:25, Niphlod  wrote:

> URL('it') is "go to the "it" function in the same controller I'm in".
> haven't played with that, but I guess web2py expects something like
> /a/lang/c/f so, by some means of request.something
> (function,controller,args,etc) you should be able to.
>
>
>
> On Friday, November 16, 2012 12:23:52 PM UTC+1, David Sorrentino wrote:
>
>> Very last doubt, I promise! :P
>>
>> Let us assume that I am visiting the page at this url:
>>
>> /en/portfolio
>>>
>>
>> and I want to change to /it/portfolio, how can I set URL in order to do
>> that?
>> If I set it like this:
>>
>> URL('it')
>>>
>>
>> I will obtain:
>>
>> /en/it
>>>
>>
>> which is an invalid function.
>>
>> Cheers,
>> David
>>
>>
>> On 16 November 2012 11:33, David Sorrentino  wrote:
>>
>>> Hi Niphlod,
>>>
>>> Thanks for your example. It's crystal clear. ;)
>>> I got another doubt about multi-languages: on the online book I read
>>> that in order to tell web2py which language is the default one, I have to
>>> use:
>>>
>>> T.set_current_languages('it')
>>>>
>>>
>>> Now I am wondering if I need to use it in the controller and call it
>>> every time I load a page, or I can put it somewhere else and tell web2py
>>> just once which one is the default language.
>>>
>>> Sorry for all these doubts! :P
>>>
>>> Cheers,
>>> David
>>>
>>>
>>>
>>> On 15 November 2012 21:46, Niphlod  wrote:
>>>
>>>> I'd do the following
>>>> 1. choose a storage option for your content (you may want to use a
>>>> simple table with a 'text' field for editing online, or code something to
>>>> save the content to a "txt" file)
>>>> 2. code something that inspects the uri_language and does
>>>> (semi-programming-language):
>>>> if exists "nameoftherequestedarticle":
>>>>   if uri_language in "translationsofthearticle":
>>>>   content = translatedarticle
>>>>   else:
>>>>   content = originalarticle (english ?)
>>>> else:
>>>> raise 404
>>>>
>>>>  --
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>  --
>
>
>
>

-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread David Sorrentino
Very last doubt, I promise! :P

Let us assume that I am visiting the page at this url:

/en/portfolio
>

and I want to change to /it/portfolio, how can I set URL in order to do
that?
If I set it like this:

URL('it')
>

I will obtain:

/en/it
>

which is an invalid function.

Cheers,
David


On 16 November 2012 11:33, David Sorrentino  wrote:

> Hi Niphlod,
>
> Thanks for your example. It's crystal clear. ;)
> I got another doubt about multi-languages: on the online book I read that
> in order to tell web2py which language is the default one, I have to use:
>
> T.set_current_languages('it')
>>
>
> Now I am wondering if I need to use it in the controller and call it every
> time I load a page, or I can put it somewhere else and tell web2py just
> once which one is the default language.
>
> Sorry for all these doubts! :P
>
> Cheers,
> David
>
>
>
> On 15 November 2012 21:46, Niphlod  wrote:
>
>> I'd do the following
>> 1. choose a storage option for your content (you may want to use a simple
>> table with a 'text' field for editing online, or code something to save the
>> content to a "txt" file)
>> 2. code something that inspects the uri_language and does
>> (semi-programming-language):
>> if exists "nameoftherequestedarticle":
>>   if uri_language in "translationsofthearticle":
>>   content = translatedarticle
>>   else:
>>   content = originalarticle (english ?)
>> else:
>> raise 404
>>
>>  --
>>
>>
>>
>>
>
>

-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread David Sorrentino
Hi Niphlod,

Thanks for your example. It's crystal clear. ;)
I got another doubt about multi-languages: on the online book I read that
in order to tell web2py which language is the default one, I have to use:

T.set_current_languages('it')
>

Now I am wondering if I need to use it in the controller and call it every
time I load a page, or I can put it somewhere else and tell web2py just
once which one is the default language.

Sorry for all these doubts! :P

Cheers,
David


On 15 November 2012 21:46, Niphlod  wrote:

> I'd do the following
> 1. choose a storage option for your content (you may want to use a simple
> table with a 'text' field for editing online, or code something to save the
> content to a "txt" file)
> 2. code something that inspects the uri_language and does
> (semi-programming-language):
> if exists "nameoftherequestedarticle":
>   if uri_language in "translationsofthearticle":
>   content = translatedarticle
>   else:
>   content = originalarticle (english ?)
> else:
> raise 404
>
>  --
>
>
>
>

-- 





Re: [web2py] Multilanguage website

2012-11-15 Thread David Sorrentino
Hey Niphlod,

Thank you for replying.

I did understand that for the interface it's beneficial to use T.
However I am not that sure I correctly understood your advice about the
content like posts, manuals, etc.
In practice you mean that I should have a default content and the
respective translations on files, db row, etc, and read them according to
the chosen language, right?

Thanks one more time.
Best,
David


On 15 November 2012 20:40, Niphlod  wrote:

> strings, small words, titles can be used with the T operator for full
> blown articles, posts, etc you can use T too, but if your website is
> basically content (posts, manuals, etc) it may be a lot easier to maintain
> a "default content" (file,db row, etc) and all the translations that, if
> not found, fall back to the "default english" content page.
>
>
> On Thursday, November 15, 2012 8:26:02 PM UTC+1, David Sorrentino wrote:
>>
>> Hi folks! :)
>>
>> I am here for asking you an opinion.
>> Since I am developing a multilanguage website, I am wondering if there is
>> a best practice for managing the translation of the content.
>> I mean, now I added in my routers:
>>
>>> myapp = dict(languages=['en', 'it', 'pl'], default_language='en')
>>>
>>> so I have the chosen language in *request.uri_language* and I can force
>> the translation in every page. In my mind this applies well to the
>> translation of the interface, but when it comes to the content it means
>> that I have to write all the content of the pages in the dictionaries which
>> are in the folder *languages*. Is that correct? Or should I put the
>> content on txt files and select them in the controller on the basis of the
>> chosen language? How would you manage this?
>>
>> Thanks in advance for your precious opinions.
>> Cheers,
>> David
>>
>  --
>
>
>
>

-- 





[web2py] Multilanguage website

2012-11-15 Thread David Sorrentino
Hi folks! :)

I am here for asking you an opinion.
Since I am developing a multilanguage website, I am wondering if there is a
best practice for managing the translation of the content.
I mean, now I added in my routers:

> myapp = dict(languages=['en', 'it', 'pl'], default_language='en')
>
> so I have the chosen language in *request.uri_language* and I can force
the translation in every page. In my mind this applies well to the
translation of the interface, but when it comes to the content it means
that I have to write all the content of the pages in the dictionaries which
are in the folder *languages*. Is that correct? Or should I put the content
on txt files and select them in the controller on the basis of the chosen
language? How would you manage this?

Thanks in advance for your precious opinions.
Cheers,
David

-- 





Re: [web2py] Re: Multi-language website with GAE + parameter-based system

2012-11-15 Thread David Sorrentino
Hi howesc,

Testing the regex I found out the error.
Intead of:

url: /(?P.+?)/static/\w\{2}?/(?P.+)


it should be:

url: /(?P.+?)/static/\w{2}?/(?P.+)
>

So a backslash was making the difference! :P

Thank you very much for your help, now everything works.

Cheers,
David


On 15 November 2012 02:42, howesc  wrote:

> the error is not obvious to me. :(  can you verify that your regex matches
> your URL?
>
>
> On Tuesday, November 13, 2012 6:01:09 AM UTC-8, David Sorrentino wrote:
>
>> Hi howesc,
>>
>> Thanks for your reply!
>>
>> I tried to set the regex for my needs, but I guess that I am wrong in
>> something.
>> I edited the regex in this way:
>>
>>> - url: /(?P.+?)/static/\w\{2}?/(?**P.+)
>>>   static_files: applications/\1/static/\2
>>>   upload: applications/(.+?)/static/(.+)
>>>   secure: optional
>>>
>>
>> Now, instead of an error, I get 2 warnings for each static file:
>>
>> WARNING  2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595]
>>> Blocking access to static file "/home/dapids/web2py/**
>>> applications/myapp/static/en/**css/bootstrap-responsive.min.**css"
>>
>>
>> WARNING  2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595]
>>> Blocking access to static file "/home/dapids/web2py/**
>>> applications/myapp/static/css/**bootstrap-responsive.min.css"
>>>
>>
>> Any thoughts?
>>
>> Cheers,
>> David
>>
>>
>> On 12 November 2012 23:03, howesc  wrote:
>>
>>> i don't know the full deal with the routerbut it looks like the path
>>> to the static files is incorrect (notice the 'en' in the path).  you can
>>> strip this out in app.yaml (my example strips out a random cache busting
>>> param after the 'static/' in the path, you can modify the regex to meet
>>> your needs):
>>>
>>> - url: /(?P.+?)/static/.*?/(?P.**+)
>>>   static_files: applications/\1/static/\2
>>>   upload: applications/(.+?)/static/(.+)
>>>   secure: optional
>>>   expiration: "1d"
>>>
>>> cfh
>>>
>>>
>>> On Monday, November 12, 2012 7:19:32 AM UTC-8, David Sorrentino wrote:
>>>>
>>>> Hello everybody! :)
>>>>
>>>> I am developing a multi-language website deployed on GAE.
>>>> For my routes.py I would like to use this configuration, shown on the
>>>> online book (http://web2py.com/books/**defau**lt/chapter/29/04#**
>>>> Parameter-**based-system<http://web2py.com/books/default/chapter/29/04#Parameter-based-system>
>>>> ):
>>>>
>>>> routers = dict(
>>>>   BASE  = dict(default_application='**myap**p'),
>>>>   myapp = dict(languages=['en', 'it', 'jp'], default_language='en'),
>>>> )
>>>>
>>>> However, it looks like I am having some troubles with loading the
>>>> static files. Indeed static files are not loaded and the console shows the
>>>> following error:
>>>> [Errno 2] No such file or directory: '/home/dapids/web2py/**applicati**
>>>> ons/myapp/en/static/**css/**bootstrap-responsive.min.**css'
>>>>
>>>> Am I doing something wrong?
>>>>
>>>> Cheers,
>>>> David
>>>>
>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: web2py as Windows service

2012-11-14 Thread David Sorrentino
NSSM is just what I was looking for. Simple and effective.
I also agree for the use of third-party software in cases like this.

Thank you one more time for your help and availability.
Saluti,
David


On 14 November 2012 14:09, Niphlod  wrote:

>
>
> Il giorno mercoledì 14 novembre 2012 11:52:36 UTC+1, David Sorrentino ha
> scritto:
>
>> Ok, I managed to make it work.
>> I set the *ip* variable to '127.0.0.1'.
>>
>> So, the ActivePython environment made the trick.
>> Thank you very much for your help Tim. ;)
>>
>> Did anyone else try to run web2py as a Windows service using the .exe
>> install? I'd rather to use the .exe install because in that way I don't
>> need to install Python before installing my app.
>>
>>
> use something external, web2py binary and services doesn't really get
> along. I use personally the http://nssm.cc/ package and I'm really happy
> with that.
> I "voted" for removing services support within web2py, the code (as all
> code around windows services with python programs) is a copy-paste of a
> copy-paste of a copy-paste of Mark Hammond's original recipe (and that was
> for XP).
> After all, programs like nssm can be more productive and are a piece of
> sotware that basically deals with all the unconsistencies of the Win API.
>
>  --
>
>
>
>

-- 





Re: [web2py] request args

2012-11-14 Thread David Sorrentino
Hello Paul,

request.args[0] returns a string, and for *Rows =
db(db.bike.id==tag_no).select()
*you need an integer.
Try this:

tag_no = int(request.args(0))
>

And let me know.

Cheers,
David


On 14 November 2012 00:28, Paul Rykiel  wrote:

> Hi just learning WEB2py and I have a question:
>
> why do i get an error on this code
>  This code errors out, but when I replace "tag_no" with 1 for record
> id 1, it works, also the variable "tag_no" has a 1 as a value when i type
> in an argument 1 on the end of the URL *
>
> def tag():
> tag_no = request.args(0)
> Title = "For Sale"
>   *  Rows = db(db.bike.id==tag_no).select()   *
> for row in Rows:
>  serial = row.serial
>  make = row.make
>  model = row.model
>  size = row.size
>  color = row.color
>  style = row.style
>  date_of_receipt = row.date_of_receipt
>  repairs = row.repairs_done
>  price = row.price
> return locals()
>
> --
>
>
>
>

-- 





Re: [web2py] Re: web2py as Windows service

2012-11-14 Thread David Sorrentino
Thanks to Niphlod, too. I hadn't seen your post! ;)

Cheers,
David


On 14 November 2012 11:52, David Sorrentino  wrote:

> Ok, I managed to make it work.
> I set the *ip* variable to '127.0.0.1'.
>
> So, the ActivePython environment made the trick.
> Thank you very much for your help Tim. ;)
>
> Did anyone else try to run web2py as a Windows service using the .exe
> install? I'd rather to use the .exe install because in that way I don't
> need to install Python before installing my app.
>
> Cheers,
> David
>
>
>
> On 14 November 2012 11:07, David Sorrentino wrote:
>
>> I just tried with ActivePython 2.7 and it works. I mean, at least the
>> task manager says that the service is running. :)
>> However I do not manage to make web2py work.
>> I am pretty sure that the problem is in my* option.py* file.
>> Now it looks like that:
>>
>> import socket
>>> import os
>>>
>>> ip = socket.gethostname()
>>> port = 8000
>>> interfaces = [('0.0.0.0', 80)]
>>>
>>> #,('0.0.0.0',443,'ssl_private_key.pem','ssl_certificate.pem')]
>>> password = ''  # ##  means use the previous password
>>>
>>> pid_filename = 'httpserver.pid'
>>> log_filename = 'httpserver.log'
>>> profiler_filename = None
>>> ssl_certificate = None  # 'ssl_certificate.pem'  # ## path to
>>> certificate file
>>> ssl_private_key = None  # 'ssl_private_key.pem'  # ## path to private
>>> key file
>>>
>>> #numthreads = 50 # ## deprecated; remove
>>> minthreads = None
>>> maxthreads = None
>>> server_name = socket.gethostname()
>>> request_queue_size = 5
>>> timeout = 30
>>> shutdown_timeout = 5
>>> folder = os.getcwd()
>>> extcron = None
>>> nocron = None
>>>
>>
>> It should work with the URL 127.0.0.1:8000, but it does not. And I do
>> not understand what *interfaces *is. :(
>> Any thoughts?
>>
>> Best,
>> David
>>
>>
>>
>> On 14 November 2012 10:25, Tim Richardson  wrote:
>>
>>> Hi David,
>>> for me the service installation has worked every time I've used it ...
>>> but that's with the ActivePython 2.7 distribution on the windows boxes, and
>>> therefore with a source installation of web2py.
>>>
>>> My practical advice is go for this set up and see if that fixes the
>>> problem. You get a considerably different Python distribution this way.
>>>
>>> regards
>>>
>>> Tim
>>>
>>>
>>>
>>> On Wednesday, 14 November 2012 18:30:38 UTC+11, David Sorrentino wrote:
>>>
>>>> Hello Derek and Tim,
>>>>
>>>> First of all thanks for your reply. :)
>>>>
>>>> @Derek: I do not see any log in the logs folder, but logging is not
>>>> enabled. This morning I will enable it and tell you the results.
>>>>
>>>> @Tim: I am testing my app on Windows 7. I did not install any Python
>>>> distribution on Windows, since I have the need of using the .exe install.
>>>> However the application has been compiled and packed on Linux
>>>> (archlinux), with web2py version 2.2.1 and Python 2.7.3 .
>>>>
>>>> Can I help more?
>>>>
>>>> I wish you a wonderful day.
>>>> David
>>>>
>>>>
>>>>  On 14 November 2012 03:27, Tim Richardson wrote:
>>>>
>>>>> what kind of Windows is it? How did you install Python, and which
>>>>> distribution is it?
>>>>> Is your Web2py a source code install, or the .exe install?
>>>>>
>>>>>  --
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>  --
>>>
>>>
>>>
>>>
>>
>>
>

-- 





Re: [web2py] Re: web2py as Windows service

2012-11-14 Thread David Sorrentino
Ok, I managed to make it work.
I set the *ip* variable to '127.0.0.1'.

So, the ActivePython environment made the trick.
Thank you very much for your help Tim. ;)

Did anyone else try to run web2py as a Windows service using the .exe
install? I'd rather to use the .exe install because in that way I don't
need to install Python before installing my app.

Cheers,
David


On 14 November 2012 11:07, David Sorrentino  wrote:

> I just tried with ActivePython 2.7 and it works. I mean, at least the task
> manager says that the service is running. :)
> However I do not manage to make web2py work.
> I am pretty sure that the problem is in my* option.py* file.
> Now it looks like that:
>
> import socket
>> import os
>>
>> ip = socket.gethostname()
>> port = 8000
>> interfaces = [('0.0.0.0', 80)]
>>
>> #,('0.0.0.0',443,'ssl_private_key.pem','ssl_certificate.pem')]
>> password = ''  # ##  means use the previous password
>>
>> pid_filename = 'httpserver.pid'
>> log_filename = 'httpserver.log'
>> profiler_filename = None
>> ssl_certificate = None  # 'ssl_certificate.pem'  # ## path to certificate
>> file
>> ssl_private_key = None  # 'ssl_private_key.pem'  # ## path to private key
>> file
>>
>> #numthreads = 50 # ## deprecated; remove
>> minthreads = None
>> maxthreads = None
>> server_name = socket.gethostname()
>> request_queue_size = 5
>> timeout = 30
>> shutdown_timeout = 5
>> folder = os.getcwd()
>> extcron = None
>> nocron = None
>>
>
> It should work with the URL 127.0.0.1:8000, but it does not. And I do not
> understand what *interfaces *is. :(
> Any thoughts?
>
> Best,
> David
>
>
>
> On 14 November 2012 10:25, Tim Richardson  wrote:
>
>> Hi David,
>> for me the service installation has worked every time I've used it ...
>> but that's with the ActivePython 2.7 distribution on the windows boxes, and
>> therefore with a source installation of web2py.
>>
>> My practical advice is go for this set up and see if that fixes the
>> problem. You get a considerably different Python distribution this way.
>>
>> regards
>>
>> Tim
>>
>>
>>
>> On Wednesday, 14 November 2012 18:30:38 UTC+11, David Sorrentino wrote:
>>
>>> Hello Derek and Tim,
>>>
>>> First of all thanks for your reply. :)
>>>
>>> @Derek: I do not see any log in the logs folder, but logging is not
>>> enabled. This morning I will enable it and tell you the results.
>>>
>>> @Tim: I am testing my app on Windows 7. I did not install any Python
>>> distribution on Windows, since I have the need of using the .exe install.
>>> However the application has been compiled and packed on Linux
>>> (archlinux), with web2py version 2.2.1 and Python 2.7.3 .
>>>
>>> Can I help more?
>>>
>>> I wish you a wonderful day.
>>> David
>>>
>>>
>>>  On 14 November 2012 03:27, Tim Richardson wrote:
>>>
>>>> what kind of Windows is it? How did you install Python, and which
>>>> distribution is it?
>>>> Is your Web2py a source code install, or the .exe install?
>>>>
>>>>  --
>>>>
>>>>
>>>>
>>>>
>>>
>>>  --
>>
>>
>>
>>
>
>

-- 





Re: [web2py] Re: web2py as Windows service

2012-11-14 Thread David Sorrentino
I just tried with ActivePython 2.7 and it works. I mean, at least the task
manager says that the service is running. :)
However I do not manage to make web2py work.
I am pretty sure that the problem is in my* option.py* file.
Now it looks like that:

import socket
> import os
>
> ip = socket.gethostname()
> port = 8000
> interfaces = [('0.0.0.0', 80)]
>
> #,('0.0.0.0',443,'ssl_private_key.pem','ssl_certificate.pem')]
> password = ''  # ##  means use the previous password
> pid_filename = 'httpserver.pid'
> log_filename = 'httpserver.log'
> profiler_filename = None
> ssl_certificate = None  # 'ssl_certificate.pem'  # ## path to certificate
> file
> ssl_private_key = None  # 'ssl_private_key.pem'  # ## path to private key
> file
> #numthreads = 50 # ## deprecated; remove
> minthreads = None
> maxthreads = None
> server_name = socket.gethostname()
> request_queue_size = 5
> timeout = 30
> shutdown_timeout = 5
> folder = os.getcwd()
> extcron = None
> nocron = None
>

It should work with the URL 127.0.0.1:8000, but it does not. And I do not
understand what *interfaces *is. :(
Any thoughts?

Best,
David


On 14 November 2012 10:25, Tim Richardson  wrote:

> Hi David,
> for me the service installation has worked every time I've used it ... but
> that's with the ActivePython 2.7 distribution on the windows boxes, and
> therefore with a source installation of web2py.
>
> My practical advice is go for this set up and see if that fixes the
> problem. You get a considerably different Python distribution this way.
>
> regards
>
> Tim
>
>
>
> On Wednesday, 14 November 2012 18:30:38 UTC+11, David Sorrentino wrote:
>
>> Hello Derek and Tim,
>>
>> First of all thanks for your reply. :)
>>
>> @Derek: I do not see any log in the logs folder, but logging is not
>> enabled. This morning I will enable it and tell you the results.
>>
>> @Tim: I am testing my app on Windows 7. I did not install any Python
>> distribution on Windows, since I have the need of using the .exe install.
>> However the application has been compiled and packed on Linux
>> (archlinux), with web2py version 2.2.1 and Python 2.7.3 .
>>
>> Can I help more?
>>
>> I wish you a wonderful day.
>> David
>>
>>
>> On 14 November 2012 03:27, Tim Richardson  wrote:
>>
>>> what kind of Windows is it? How did you install Python, and which
>>> distribution is it?
>>> Is your Web2py a source code install, or the .exe install?
>>>
>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: web2py as Windows service

2012-11-13 Thread David Sorrentino
Hello Derek and Tim,

First of all thanks for your reply. :)

@Derek: I do not see any log in the logs folder, but logging is not
enabled. This morning I will enable it and tell you the results.

@Tim: I am testing my app on Windows 7. I did not install any Python
distribution on Windows, since I have the need of using the .exe install.
However the application has been compiled and packed on Linux (archlinux),
with web2py version 2.2.1 and Python 2.7.3 .

Can I help more?

I wish you a wonderful day.
David


On 14 November 2012 03:27, Tim Richardson  wrote:

> what kind of Windows is it? How did you install Python, and which
> distribution is it?
> Is your Web2py a source code install, or the .exe install?
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: Multi-language website with GAE + parameter-based system

2012-11-13 Thread David Sorrentino
Hi howesc,

Thanks for your reply!

I tried to set the regex for my needs, but I guess that I am wrong in
something.
I edited the regex in this way:

> - url: /(?P.+?)/static/\w\{2}?/(?P.+)
>   static_files: applications/\1/static/\2
>   upload: applications/(.+?)/static/(.+)
>   secure: optional
>

Now, instead of an error, I get 2 warnings for each static file:

WARNING  2012-11-13 13:54:19,604 dev_appserver_import_hook.py:595] Blocking
> access to static file
> "/home/dapids/web2py/applications/myapp/static/en/css/bootstrap-responsive.min.css"


WARNING  2012-11-13 13:54:19,604 dev_appserver_import_hook.py:595] Blocking
> access to static file
> "/home/dapids/web2py/applications/myapp/static/css/bootstrap-responsive.min.css"
>

Any thoughts?

Cheers,
David


On 12 November 2012 23:03, howesc  wrote:

> i don't know the full deal with the routerbut it looks like the path
> to the static files is incorrect (notice the 'en' in the path).  you can
> strip this out in app.yaml (my example strips out a random cache busting
> param after the 'static/' in the path, you can modify the regex to meet
> your needs):
>
> - url: /(?P.+?)/static/.*?/(?P.+)
>   static_files: applications/\1/static/\2
>   upload: applications/(.+?)/static/(.+)
>   secure: optional
>   expiration: "1d"
>
> cfh
>
>
> On Monday, November 12, 2012 7:19:32 AM UTC-8, David Sorrentino wrote:
>>
>> Hello everybody! :)
>>
>> I am developing a multi-language website deployed on GAE.
>> For my routes.py I would like to use this configuration, shown on the
>> online book (http://web2py.com/books/**default/chapter/29/04#**
>> Parameter-based-system<http://web2py.com/books/default/chapter/29/04#Parameter-based-system>
>> ):
>>
>> routers = dict(
>>   BASE  = dict(default_application='**myapp'),
>>   myapp = dict(languages=['en', 'it', 'jp'], default_language='en'),
>> )
>>
>> However, it looks like I am having some troubles with loading the static
>> files. Indeed static files are not loaded and the console shows the
>> following error:
>> [Errno 2] No such file or directory: '/home/dapids/web2py/**
>> applications/myapp/en/static/**css/bootstrap-responsive.min.**css'
>>
>> Am I doing something wrong?
>>
>> Cheers,
>> David
>>
>  --
>
>
>
>

-- 





Re: [web2py] salary survey info

2012-11-12 Thread David Sorrentino
+1 ;)

On 12 November 2012 16:41, Massimo Di Pierro wrote:

>
> http://www.infoworld.com/t/it-jobs/2013-it-salaries-15-titles-getting-the-biggest-pay-raises-206630?source=IFWNLE_nlt_wrapup_2012-11-10
>
> --
>
>
>
>

-- 





[web2py] Multi-language website with GAE + parameter-based system

2012-11-12 Thread David Sorrentino
Hello everybody! :)

I am developing a multi-language website deployed on GAE.
For my routes.py I would like to use this configuration, shown on the 
online book (
http://web2py.com/books/default/chapter/29/04#Parameter-based-system):

routers = dict(
  BASE  = dict(default_application='myapp'),
  myapp = dict(languages=['en', 'it', 'jp'], default_language='en'),
)

However, it looks like I am having some troubles with loading the static 
files. Indeed static files are not loaded and the console shows the 
following error:
[Errno 2] No such file or directory: 
'/home/dapids/web2py/applications/myapp/en/static/css/bootstrap-responsive.min.css'

Am I doing something wrong?

Cheers,
David

-- 





[web2py] web2py as Windows service

2012-11-12 Thread David Sorrentino
Hello folks! :)

I am trying to run web2py as Windows service, but no positive results.
Following the recipe on the online book, I edited the file "options.py".
The file looks like that:
#!/usr/bin/python
# -*- coding: utf-8 -*-

import socket
import os

ip = 127.0.0.1
port = 8000
interfaces = [('127.0.0.1', 8000)]
password = ''  
pid_filename = 'httpserver.pid'
log_filename = 'httpserver.log'
profiler_filename = None
ssl_certificate = None 
ssl_private_key = None 
#numthreads = 50 # ## deprecated; remove
minthreads = None
maxthreads = None
server_name = socket.gethostname()
request_queue_size = 5
timeout = 30
shutdown_timeout = 5
folder = os.getcwd()
extcron = None
nocron = None

When I install the service, everything seems to be OK:
C:\Users\David\Desktop\myapp\web2py>web2py.exe -W install
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2012
Version 2.2.1 (2012-10-21 16:57:04) stable
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(
pg8000),
 MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), IMAP(imaplib)
Installing service web2py
Changing service configuration
Service updated

But when I launch the service, something goes wrong:
C:\Users\David\Desktop\myapp\web2py>web2py.exe -W start
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2012
Version 2.2.1 (2012-10-21 16:57:04) stable
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(
pg8000),
 MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), IMAP(imaplib)
Starting service web2py
Error starting service: The service did not respond to the start or control 
requ
est in a timely fashion.

Can anybody help me in that? :)

Cheers,
David

-- 





[web2py] Choosing the PDF file's name with appreport PISA

2012-11-11 Thread David Sorrentino
Hello everybody! :)

I am using appreport with the PISA engine in order to export a view to a 
PDF file and I would like to choose the name of the PDF file generated.
The view is the following one:
results = dict(success=True)
html = response.render('default/results.html', results)
return plugin_appreport.REPORTPISA(html = html, response_filename = 
'change_my_name.pdf')

As you can see, I used the parameter *response_filename* for setting a 
custom name, but it doesn't seem to work.
Any suggestions? 

Cheers,
David

-- 





Re: [web2py] Plugin installation without admin

2012-11-10 Thread David Sorrentino
Easier than expected! :)

Thank you Massimo.

I wish you a good Sunday.
David


On 11 November 2012 01:15, Massimo Di Pierro wrote:

> cd applications/yourapp
> tar zxvf /path/to/web2py.plugin.name.w2p
>
>
> On Saturday, 10 November 2012 16:34:21 UTC-6, David Sorrentino wrote:
>>
>> Hello everybody,
>>
>> I am wondering if there is a way to install a plugin without using the
>> admin interface.
>> Can anybody help me in that?
>>
>> Cheers,
>> David
>>
>  --
>
>
>
>

-- 





[web2py] Plugin installation without admin

2012-11-10 Thread David Sorrentino
Hello everybody,

I am wondering if there is a way to install a plugin without using the
admin interface.
Can anybody help me in that?

Cheers,
David

-- 





Re: [web2py] Re: How to make a dropdown optional?

2012-11-06 Thread David Sorrentino
Ok, I am stupid! :P

I was overwriting the value of the zero field with
*form.custom.widget.just_a_dropdown[0]
= 'new_value'* .
This was messing up the validation, obviously.
Thank you for your help Massimo.

Have a nice day,
David


On 6 November 2012 16:30, Massimo Di Pierro wrote:

> How about
>
> IS_EMPTY_OR(IS_IN_**SET(,zero=''))
>
>
> On Tuesday, 6 November 2012 08:31:49 UTC-6, David Sorrentino wrote:
>
>> Hi Massimo, and thank you for your reply. :)
>>
>> I had already tried requires=IS_EMPTY_OR(IS_IN_**SET()) and it seems
>> not to work. The form is not accepted because the selected value is not in
>> the set.
>> Perhaps I am missing something!?
>>
>> Cheers,
>> David
>>
>>
>> On 6 November 2012 14:42, Massimo Di Pierro wrote:
>>
>>> requires=IS_EMPTY_OR(IS_IN_**SET())
>>>
>>>
>>> On Tuesday, 6 November 2012 06:46:24 UTC-6, David Sorrentino wrote:
>>>>
>>>> Hey there! :)
>>>>
>>>> Other day, other doubt. :P
>>>>
>>>> In my controller I define a form with SQLFORM.factory. This form
>>>> contains a dropdown.
>>>> Here is the code.
>>>> def mansioni():
>>>> form = SQLFORM.factory(
>>>> Field('just_a_dropdown', requires=IS_IN_SET({'first_**cho**ice'
>>>> : 'First choice', 'second_choice': 'Second choice'}, zero='Please,
>>>> make your choice...'))
>>>> )
>>>> return dict(form=form)
>>>>
>>>> My problem is that, understandably, one of the two values must be
>>>> selected, otherwise the form will not be accepted.
>>>> So the question is: is there any way to make this dropdown optional?
>>>>
>>>> Best,
>>>> David
>>>>
>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: How to make a dropdown optional?

2012-11-06 Thread David Sorrentino
Hi Massimo, and thank you for your reply. :)

I had already tried requires=IS_EMPTY_OR(IS_IN_SET()) and it seems not
to work. The form is not accepted because the selected value is not in the
set.
Perhaps I am missing something!?

Cheers,
David


On 6 November 2012 14:42, Massimo Di Pierro wrote:

> requires=IS_EMPTY_OR(IS_IN_SET())
>
>
> On Tuesday, 6 November 2012 06:46:24 UTC-6, David Sorrentino wrote:
>>
>> Hey there! :)
>>
>> Other day, other doubt. :P
>>
>> In my controller I define a form with SQLFORM.factory. This form contains
>> a dropdown.
>> Here is the code.
>> def mansioni():
>> form = SQLFORM.factory(
>> Field('just_a_dropdown', requires=IS_IN_SET({'first_**choice': 'First
>> choice', 'second_choice': 'Second choice'}, zero='Please, make your
>> choice...'))
>> )
>> return dict(form=form)
>>
>> My problem is that, understandably, one of the two values must be
>> selected, otherwise the form will not be accepted.
>> So the question is: is there any way to make this dropdown optional?
>>
>> Best,
>> David
>>
>  --
>
>
>
>

-- 





[web2py] How to make a dropdown optional?

2012-11-06 Thread David Sorrentino
Hey there! :)

Other day, other doubt. :P

In my controller I define a form with SQLFORM.factory. This form contains a 
dropdown.
Here is the code.
def mansioni():
form = SQLFORM.factory(
Field('just_a_dropdown', requires=IS_IN_SET({'first_choice': 'First 
choice', 'second_choice': 'Second choice'}, zero='Please, make your 
choice...'))
)
return dict(form=form)

My problem is that, understandably, one of the two values must be selected, 
otherwise the form will not be accepted.
So the question is: is there any way to make this dropdown optional?

Best,
David

-- 





Re: [web2py] Re: Problems with LOAD and redirect(..., type='auto')

2012-11-05 Thread David Sorrentino
Thanks a lot Leonel!
It works. ;)

Wish you a good day,
David


On 5 November 2012 15:27, Leonel Câmara  wrote:

> I believe what you want is now:
>
> client_side=True
>
>
> as an argument to the redirect, instead of the type='auto'
>
> The book seems to be outdated in that part.
>
> --
>
>
>
>

-- 





[web2py] Problems with LOAD and redirect(..., type='auto')

2012-11-05 Thread David Sorrentino
Hello everybody, :)

In practice, I have a page (default/calculate.html) which in turn loads 
another page (forms/mansioni.load) by means of LOAD.
Here the code of the page* default/calculate.html*:


{{=LOAD('forms', 'mansioni.load', ajax=True)}}



The page *forms/mansioni.load* contains just a form, as the following code 
shows.
{{=form}}

When I submit a form (correctly filled), I would like to redirect the 
parent page *(default/calculate.html*) to another page.
According to the online book, this seems to be possible by using the 
syntax"redirect(url,type='auto')". So I wrote the controller 
*forms.py* in this way:
def mansioni():
form = SQLFORM.factory(
Field('something', 'string', requires=(IS_NOT_EMPTY()))
)
if form.accepts(request, session):
redirect(URL('default', 'someOtherPage', extension=False), 
type='auto')
return dict(form=form)

Unfortunately, I get the following error:
TypeError: redirect() got an unexpected keyword argument 'type'

It looks like there is no such an argument for the method *redirect*.

The web2py version I am using is: 2.2.1 (2012-10-29 09:31:46) stable.
The application is running on GAE.

Some thoughts? :)

Best,
David

-- 





Re: [web2py] routes.py and anchor links

2012-10-23 Thread David Sorrentino
I tried the parametric router and it works super-fine!
I wasn't using it because at the very beginning I found the pattern-based
method more powerful.

Thank you very much for your help Jonathan!
I wish you a good Tuesday! ;)

Cheers,
David


On 22 October 2012 18:55, Jonathan Lundell  wrote:

> On 22 Oct 2012, at 9:28 AM, David Sorrentino 
> wrote:
> > I have got some doubts about the use of anchor links and the URL
> rewriting by means of routes.py.
> >
> > This is my routes.py:
> >
> > routes_out = (
> > ('/myapp/default/$f', '/$f')
> > )
> >
> > So /myapp/default/just_a_page is rewritten in output like /just_a_page .
> This works.
> >
> > The problem raises when I specify an anchor link in my view, for
> instance:
> > {{=URL(f='just_a_page', anchor="just_an_anchor")}}
> >
> > Indeed in this case routes.py does not rewrite the URL, since
> /myapp/default/just_a_page#just_an_anchor does not match
> with/myapp/default/$f (understandably).
> >
> > So, how could I set up routes.py so that it will rewrite URLs containing
> anchors?
> >
> > Thank you in advance for your help.
>
> Can you use the parametric router? It should handle anchors properly.
>
> Alternatively, try something like:
>
> routes_out = (
> ('/myapp/default/$f', '/$f')
> ('/myapp/default/$f/$anything', '/$f/$anything')
> )
>
>
> --
>
>
>
>

-- 





[web2py] routes.py and anchor links

2012-10-22 Thread David Sorrentino
Hey there! :)

I have got some doubts about the use of anchor links and the URL rewriting
by means of *routes.py*.

This is my *routes.py*:

routes_out = (
> ('/myapp/default/$f', '/$f')
> )
>

So* **/myapp/default/just_a_page* is rewritten in output like
*/just_a_page*. This works.

The problem raises when I specify an anchor link in my view, for instance:

> {{=URL(f='just_a_page', anchor="just_an_anchor")}}
>

Indeed in this case *routes.py* does not rewrite the URL, since *
**/myapp/default/just_a_page#just_an_anchor
*does not match with */myapp/default/$f* (understandably).

So, how could I set* *up *routes.py* so that it will rewrite URLs
containing anchors?

Thank you in advance for your help.

Cheers,
David

-- 





Re: [web2py] ondelete and onaccept

2012-10-15 Thread David Sorrentino
Thanks Alan,

This works fine. I just misunderstood the book. ;)

Have a good day,
David


On 15 October 2012 01:47, Alan Etkin  wrote:

> For me the behavior is the expected (because the form was accepted and the
> record deleted). Perhaps you can avoid executing onaccept inside the
> handler like this:
>
> def myonaccept(form):
> if form.vars.delete_this_record
> return
> ...
>
>
>
>
> --
>
>
>
>

-- 





[web2py] ondelete and onaccept

2012-10-13 Thread David Sorrentino
Hi there,

Maybe I just misunderstood the online book, but I would like to solve my
doubts about this:
In chaper #07, speaking about the CRUD method *ondelete*, the book says:

ondelete is called in place of onaccept when a record is deleted via an
> "update" form.
>

I added both to my *crud.update*, in this way:

form = crud.update(db.news, db(db.news.id==newsId).select().first(),
> onaccept=lambda form: utilities.update_history(form, T('edited the news'),
> session, auth.user.username), ondelete=lambda form:
> utilities.update_history(form, T('deleted the news'), session,
> auth.user.username))
>

The odd thing is that in case of deletion, *ondelete* and *onaccept* seem
to be both fired.
Is that supposed to be so?
What if in case of deletion I need to fire just *ondelete*?

Best,
David

-- 





Re: [web2py] Issues with GAE?

2012-10-13 Thread David Sorrentino
Perfectly working! :)
Thanks Massimo!!

I wish you a wonderful Saturday,
David


On 13 October 2012 16:38, Massimo Di Pierro wrote:

> I just fixes this. Good cache. This is a part of a redesign of the
> custom_importer. This should result in a faster web2py on GAE.
> Before web2py was using the custom importer for every import thus creating
> problems.
>
>
> On Saturday, 13 October 2012 09:12:26 UTC-5, David Sorrentino wrote:
>>
>> Hello everybody! ;)
>>
>> I updated web2py to the last stable version and now I'm getting this
>> error:
>>
>> ERROR2012-10-13 14:06:26,000 wsgi.py:219]
>>> Traceback (most recent call last):
>>>   File "/home/dapids/google_**appengine/google/appengine/**runtime/wsgi.py",
>>> line 208, in Handle
>>> for chunk in result:
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**ext/appstats/recording.py",
>>> line 1284, in appstats_wsgi_wrapper
>>> result = app(environ, appstats_start_response)
>>>   File "/home/dapids/webdev/**backinterface/web2py/**gaehandler.py",
>>> line 65, in newfun
>>> executed_function = fun(env, res)
>>>   File "/home/dapids/webdev/**backinterface/web2py/**gaehandler.py",
>>> line 88, in wsgiapp
>>> custom_import_install(web2py_**path)
>>> TypeError: custom_import_install() takes no arguments (1 given)
>>>
>>
>> I also tried with the last version in trunk. Same issue.
>>
>> Just tell me if you need more information.
>>
>> Cheers,
>> David
>>
>  --
>
>
>
>

-- 





[web2py] Issues with GAE?

2012-10-13 Thread David Sorrentino
Hello everybody! ;)

I updated web2py to the last stable version and now I'm getting this error:

ERROR2012-10-13 14:06:26,000 wsgi.py:219]
> Traceback (most recent call last):
>   File "/home/dapids/google_appengine/google/appengine/runtime/wsgi.py",
> line 208, in Handle
> for chunk in result:
>   File
> "/home/dapids/google_appengine/google/appengine/ext/appstats/recording.py",
> line 1284, in appstats_wsgi_wrapper
> result = app(environ, appstats_start_response)
>   File "/home/dapids/webdev/backinterface/web2py/gaehandler.py", line 65,
> in newfun
> executed_function = fun(env, res)
>   File "/home/dapids/webdev/backinterface/web2py/gaehandler.py", line 88,
> in wsgiapp
> custom_import_install(web2py_path)
> TypeError: custom_import_install() takes no arguments (1 given)
>

I also tried with the last version in trunk. Same issue.

Just tell me if you need more information.

Cheers,
David

-- 





Re: [web2py] Re: Prettydate and time zones

2012-10-12 Thread David Sorrentino
It works like a charm. :)

Thanks a lot for your help guys. I would have never figured it out by
myself!

Have a wonderful Friday!
David


On 12 October 2012 00:34, Niphlod  wrote:

> you're overridding the default validator (IS_DATE*) with IS_NOT_EMPTY
>
> replacing this line
> db.news.date_local.requires = IS_NOT_EMPTY()
> with
> db.news.date_local.requires.append(IS_NOT_EMPTY())
>
> should work.
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: Prettydate and time zones

2012-10-11 Thread David Sorrentino
Not a problem! ;)

Here the *model*:

> db.define_table('news',
> Field('title', 'string'),
> Field('body', 'text'),
> Field('date_local', 'datetime'),
> Field('date_utc', 'datetime', readable=False, writable=False)
> )
>
> db.news.title.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'news.title')]
> db.news.body.requires = IS_NOT_EMPTY()
> db.news.date_local.requires = IS_NOT_EMPTY()
>

Here the *controller*:

> @auth.requires_login()
> def insertnews():
> form = crud.create(db.news, next=URL('index'),
> onvalidation=localtime_to_utc)
> return dict(form=form)
>

Here the *view*:

> {{

=form.custom.begin
> =form.custom.widget.title
> =form.custom.widget.body
> =form.custom.widget.date_local
> =form.custom.submit
> =form.custom.end
> }}
>

And here the module to convert the local time to UTC:

> from datetime import timedelta
> def localtime_to_utc(form):
> form.vars.dateUTC = form.vars.date_local - timedelta(hours=2)
>

The error I get is:

>  TypeError: unsupported operand type(s) for -: 'str' and
> 'datetime.timedelta'
>

Just tell me if I have to provide other information about the issue.

Thanks a lot. :)

Best,
David


On 11 October 2012 22:44, Massimo Di Pierro wrote:

> We need to see some of the code. Somehow the validator is not called.
>
>
> On Thursday, 11 October 2012 13:32:40 UTC-5, David Sorrentino wrote:
>
>> I'm using a custom form, but no custom validators.
>> Do you need some additional information?
>>
>> Cheers,
>> David
>>
>>
>> On 11 October 2012 15:34, Massimo Di Pierro wrote:
>>
>>> Is it possible you have a custom validator?
>>>
>>> is should have a IS_DATE validator (default). It is the validator that
>>> maps request.vars.date into form.vars.date and performs the conversion.
>>>
>>>
>>> On Thursday, 11 October 2012 06:30:46 UTC-5, David Sorrentino wrote:
>>>
>>>> Changed the name of the field from "date" to "created_on" to avoid
>>>> confusion.
>>>> Tried with a fresh table.
>>>> Result:
>>>> *form.vars.created_on* seems to be still an object of type str.
>>>>
>>>> Am I missing something? :-/
>>>>
>>>> Cheers,
>>>> David
>>>>
>>>>
>>>> On 11 October 2012 11:45, Niphlod  wrote:
>>>>
>>>>> uhm. I can't reproduce the issue. For me form.vars.whatever if is a
>>>>> field of type datetime is a datetime tuple. Request.vars.whatever on the
>>>>> other hand is always a string, as it should be.
>>>>>
>>>>> Try with a fresh table
>>>>>
>>>>> PS: having a db with a column named "date" is a call for problems ...
>>>>>
>>>>> On Thursday, October 11, 2012 11:27:52 AM UTC+2, David Sorrentino
>>>>> wrote:
>>>>>
>>>>>> Thanks for your explanation Niphlod. ;)
>>>>>>
>>>>>> I'm trying to normalize the time, as you suggested.
>>>>>> However I'm facing some difficulties.
>>>>>>
>>>>>> In particular I created an additional field in my table to store the
>>>>>> normalized time (UTC) too. So now my table looks like that:
>>>>>>
>>>>>>> db.define_table('news',
>>>>>>> Field('title', 'string'),
>>>>>>> Field('body', 'text'),
>>>>>>> Field('date', 'datetime'),
>>>>>>> Field('dateUTC', 'datetime', readable=False, writable=False)
>>>>>>> )
>>>>>>>
>>>>>>
>>>>>> I decided to compute the field "dateUTC" onvalidation. My controller
>>>>>> looks like that:
>>>>>>
>>>>>>> def insertnews():
>>>>>>> form = crud.create(db.news, next=URL('index'),
>>>>>>> onvalidation=localtime_to_utc)
>>>>>>> return dict(form=form)
>>>>>>>
>>>>>>
>>>>>> Eventually, assuming that I want to normalize the local time of Rome
>>>>>> (+2 hours) the function I use to do that looks so:
>>>>>>
>>>>&

Re: [web2py] Re: Prettydate and time zones

2012-10-11 Thread David Sorrentino
I'm using a custom form, but no custom validators.
Do you need some additional information?

Cheers,
David


On 11 October 2012 15:34, Massimo Di Pierro wrote:

> Is it possible you have a custom validator?
>
> is should have a IS_DATE validator (default). It is the validator that
> maps request.vars.date into form.vars.date and performs the conversion.
>
>
> On Thursday, 11 October 2012 06:30:46 UTC-5, David Sorrentino wrote:
>
>> Changed the name of the field from "date" to "created_on" to avoid
>> confusion.
>> Tried with a fresh table.
>> Result:
>> *form.vars.created_on* seems to be still an object of type str.
>>
>> Am I missing something? :-/
>>
>> Cheers,
>> David
>>
>>
>> On 11 October 2012 11:45, Niphlod  wrote:
>>
>>> uhm. I can't reproduce the issue. For me form.vars.whatever if is a
>>> field of type datetime is a datetime tuple. Request.vars.whatever on the
>>> other hand is always a string, as it should be.
>>>
>>> Try with a fresh table
>>>
>>> PS: having a db with a column named "date" is a call for problems ...
>>>
>>> On Thursday, October 11, 2012 11:27:52 AM UTC+2, David Sorrentino wrote:
>>>
>>>> Thanks for your explanation Niphlod. ;)
>>>>
>>>> I'm trying to normalize the time, as you suggested.
>>>> However I'm facing some difficulties.
>>>>
>>>> In particular I created an additional field in my table to store the
>>>> normalized time (UTC) too. So now my table looks like that:
>>>>
>>>>> db.define_table('news',
>>>>> Field('title', 'string'),
>>>>> Field('body', 'text'),
>>>>> Field('date', 'datetime'),
>>>>> Field('dateUTC', 'datetime', readable=False, writable=False)
>>>>> )
>>>>>
>>>>
>>>> I decided to compute the field "dateUTC" onvalidation. My controller
>>>> looks like that:
>>>>
>>>>> def insertnews():
>>>>> form = crud.create(db.news, next=URL('index'),
>>>>> onvalidation=localtime_to_utc)
>>>>> return dict(form=form)
>>>>>
>>>>
>>>> Eventually, assuming that I want to normalize the local time of Rome
>>>> (+2 hours) the function I use to do that looks so:
>>>>
>>>>> def localtime_to_utc(form):
>>>>> form.vars.dateUTC = form.vars.date - timedelta(hours=2)
>>>>>
>>>>
>>>> The problem is that *form.vars.date* seems to be a string. O_O
>>>> Indeed I get this error:
>>>>
>>>>> TypeError: unsupported operand type(s) for -: 'str' and
>>>>> 'datetime.timedelta'
>>>>>
>>>>
>>>>  Now I wonder, is it normal that a form.vars is considered a string? Is
>>>> there any way to retrieve the original type (datetime), in order to compute
>>>> the normalization?
>>>>
>>>> @Alec: if I manage I'll send them a mail with the solution! ;)
>>>>
>>>> Cheers,
>>>> David
>>>>
>>>>
>>>> On 10 October 2012 14:35, Alec Taylor  wrote:
>>>>
>>>>> Also if it makes you feel better LinkedIn hasn't implemented this
>>>>> properly either :P
>>>>>
>>>>> On Wed, Oct 10, 2012 at 10:57 PM, Niphlod  wrote:
>>>>> > welcome to datetime madness :D It's exactly what you need to take
>>>>> into
>>>>> > consideration if you're working with user-inputted datetimes. You'd
>>>>> need to
>>>>> > retrieve it's local date (javascript comes to the rescue, or based on
>>>>> > nation, or whatever) and calculate the difference between that and
>>>>> your
>>>>> > current date, then subtract/add the difference to the actually
>>>>> submitted
>>>>> > datetime to "normalize" it in a UTC form.
>>>>> >
>>>>> >
>>>>> > On Wednesday, October 10, 2012 1:01:35 PM UTC+2, David Sorrentino
>>>>> wrote:
>>>>> >>
>>>>> >> I see your point, but what if the user inserts into the datetime
>>>>> input
>&g

Re: [web2py] Re: Prettydate and time zones

2012-10-11 Thread David Sorrentino
Changed the name of the field from "date" to "created_on" to avoid
confusion.
Tried with a fresh table.
Result:
*form.vars.created_on* seems to be still an object of type str.

Am I missing something? :-/

Cheers,
David


On 11 October 2012 11:45, Niphlod  wrote:

> uhm. I can't reproduce the issue. For me form.vars.whatever if is a field
> of type datetime is a datetime tuple. Request.vars.whatever on the other
> hand is always a string, as it should be.
>
> Try with a fresh table
>
> PS: having a db with a column named "date" is a call for problems ...
>
> On Thursday, October 11, 2012 11:27:52 AM UTC+2, David Sorrentino wrote:
>
>> Thanks for your explanation Niphlod. ;)
>>
>> I'm trying to normalize the time, as you suggested.
>> However I'm facing some difficulties.
>>
>> In particular I created an additional field in my table to store the
>> normalized time (UTC) too. So now my table looks like that:
>>
>>> db.define_table('news',
>>> Field('title', 'string'),
>>> Field('body', 'text'),
>>> Field('date', 'datetime'),
>>> Field('dateUTC', 'datetime', readable=False, writable=False)
>>> )
>>>
>>
>> I decided to compute the field "dateUTC" onvalidation. My controller
>> looks like that:
>>
>>> def insertnews():
>>> form = crud.create(db.news, next=URL('index'),
>>> onvalidation=localtime_to_utc)
>>> return dict(form=form)
>>>
>>
>> Eventually, assuming that I want to normalize the local time of Rome (+2
>> hours) the function I use to do that looks so:
>>
>>> def localtime_to_utc(form):
>>> form.vars.dateUTC = form.vars.date - timedelta(hours=2)
>>>
>>
>> The problem is that *form.vars.date* seems to be a string. O_O
>> Indeed I get this error:
>>
>>> TypeError: unsupported operand type(s) for -: 'str' and
>>> 'datetime.timedelta'
>>>
>>
>>  Now I wonder, is it normal that a form.vars is considered a string? Is
>> there any way to retrieve the original type (datetime), in order to compute
>> the normalization?
>>
>> @Alec: if I manage I'll send them a mail with the solution! ;)
>>
>> Cheers,
>> David
>>
>>
>> On 10 October 2012 14:35, Alec Taylor  wrote:
>>
>>> Also if it makes you feel better LinkedIn hasn't implemented this
>>> properly either :P
>>>
>>> On Wed, Oct 10, 2012 at 10:57 PM, Niphlod  wrote:
>>> > welcome to datetime madness :D It's exactly what you need to take into
>>> > consideration if you're working with user-inputted datetimes. You'd
>>> need to
>>> > retrieve it's local date (javascript comes to the rescue, or based on
>>> > nation, or whatever) and calculate the difference between that and your
>>> > current date, then subtract/add the difference to the actually
>>> submitted
>>> > datetime to "normalize" it in a UTC form.
>>> >
>>> >
>>> > On Wednesday, October 10, 2012 1:01:35 PM UTC+2, David Sorrentino
>>> wrote:
>>> >>
>>> >> I see your point, but what if the user inserts into the datetime input
>>> >> field his/her current time? It will be different from the server's one
>>> >> (which I set to GMT), and prettydate will not work properly.
>>> >>
>>> >> I confess that I am a bit confused about that.
>>> >>
>>> >> Best,
>>> >> David
>>> >>
>>> >>
>>> >> On 10 October 2012 11:16, Niphlod  wrote:
>>> >>>
>>> >>> not necessarily wrong, just a different timezone. If you're going to
>>> >>> display "prettydates" just in the browser for a "nicer
>>> visualization" you
>>> >>> should take into consideration that your server's locatime can be
>>> different
>>> >>> from the users's browser one.
>>> >>>
>>> >>> In a "perfect" setup, your server is on GMT (that is, utc), your app
>>> uses
>>> >>> request.utcnow in all the places instead of request.now (and
>>> >>> datetime.datetime.utcnow() instead of datetime.datetime.utcnow()).
>>> You'll
>>> >>> have p

Re: [web2py] Re: Prettydate and time zones

2012-10-11 Thread David Sorrentino
Thanks for your explanation Niphlod. ;)

I'm trying to normalize the time, as you suggested.
However I'm facing some difficulties.

In particular I created an additional field in my table to store the
normalized time (UTC) too. So now my table looks like that:

> db.define_table('news',
> Field('title', 'string'),
> Field('body', 'text'),
> Field('date', 'datetime'),
> Field('dateUTC', 'datetime', readable=False, writable=False)
> )
>

I decided to compute the field "dateUTC" onvalidation. My controller looks
like that:

> def insertnews():
> form = crud.create(db.news, next=URL('index'),
> onvalidation=localtime_to_utc)
> return dict(form=form)
>

Eventually, assuming that I want to normalize the local time of Rome (+2
hours) the function I use to do that looks so:

> def localtime_to_utc(form):
> form.vars.dateUTC = form.vars.date - timedelta(hours=2)
>

The problem is that *form.vars.date* seems to be a string. O_O
Indeed I get this error:

> TypeError: unsupported operand type(s) for -: 'str' and
> 'datetime.timedelta'
>

 Now I wonder, is it normal that a form.vars is considered a string? Is
there any way to retrieve the original type (datetime), in order to compute
the normalization?

@Alec: if I manage I'll send them a mail with the solution! ;)

Cheers,
David


On 10 October 2012 14:35, Alec Taylor  wrote:

> Also if it makes you feel better LinkedIn hasn't implemented this
> properly either :P
>
> On Wed, Oct 10, 2012 at 10:57 PM, Niphlod  wrote:
> > welcome to datetime madness :D It's exactly what you need to take into
> > consideration if you're working with user-inputted datetimes. You'd need
> to
> > retrieve it's local date (javascript comes to the rescue, or based on
> > nation, or whatever) and calculate the difference between that and your
> > current date, then subtract/add the difference to the actually submitted
> > datetime to "normalize" it in a UTC form.
> >
> >
> > On Wednesday, October 10, 2012 1:01:35 PM UTC+2, David Sorrentino wrote:
> >>
> >> I see your point, but what if the user inserts into the datetime input
> >> field his/her current time? It will be different from the server's one
> >> (which I set to GMT), and prettydate will not work properly.
> >>
> >> I confess that I am a bit confused about that.
> >>
> >> Best,
> >> David
> >>
> >>
> >> On 10 October 2012 11:16, Niphlod  wrote:
> >>>
> >>> not necessarily wrong, just a different timezone. If you're going to
> >>> display "prettydates" just in the browser for a "nicer visualization"
> you
> >>> should take into consideration that your server's locatime can be
> different
> >>> from the users's browser one.
> >>>
> >>> In a "perfect" setup, your server is on GMT (that is, utc), your app
> uses
> >>> request.utcnow in all the places instead of request.now (and
> >>> datetime.datetime.utcnow() instead of datetime.datetime.utcnow()).
> You'll
> >>> have prettydate working right.
> >>>
> >>>
> >>> On Wednesday, October 10, 2012 10:38:32 AM UTC+2, David Sorrentino
> wrote:
> >>>>
> >>>> Hey Niphlod,
> >>>>
> >>>> Thank you for your help.
> >>>>
> >>>> The version is 2.0.9 (2012-10-05 09:01:45) dev
> >>>>
> >>>> I tried datetime.datetime.now() in my application and I just
> discovered
> >>>> that it is 2 hours late. This explains why prettydate is then 2 hours
> in
> >>>> hurry!
> >>>> The odd thing is that if I open a python console and try
> >>>> datetime.datetime.now(), I get the right time. O_O
> >>>>
> >>>> Something wrong with my server?
> >>>>
> >>>> Cheers,
> >>>> David
> >>>>
> >>>>
> >>>> On 10 October 2012 10:28, Niphlod  wrote:
> >>>>>
> >>>>> should calculate the difference between datetime.datetime.now() and
> >>>>> your date. what web2py version are you using ?
> >>>>>
> >>>>>
> >>>>> On Wednesday, October 10, 2012 10:16:24 AM UTC+2, David Sorrentino
> >>>>> wrote:
> >>>>>>
> >>>>>> Hello everybody,
> >>>>>>
> >>>>>> I am using the module prettydate, but it seems that it matches the
> >>>>>> datetime I give as input with a wrong timezone.
> >>>>>>
> >>>>>> For example now it's 10:12 am at my place.
> >>>>>>
> >>>>>> This is the datetime I give as input: 2012-10-10 10:12:00.
> >>>>>>
> >>>>>> This is the code:
> >>>>>>
> >>>>>>> from gluon.tools import prettydate
> >>>>>>> pretty_d = prettydate(input_datetime, T)
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> And this is the result: "2 hours from now".
> >>>>>> It's 2 hours in hurry!! :)
> >>>>>>
> >>>>>> Am I wrong in something?
> >>>>>>
> >>>>>> I wish you a wonderful Wednesday,
> >>>>>> David
> >>>>>>
> >>>>>>
> >>>>> --
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>> --
> >>>
> >>>
> >>>
> >>
> >>
> > --
> >
> >
> >
>
> --
>
>
>
>

-- 





Re: [web2py] Re: Prettydate and time zones

2012-10-10 Thread David Sorrentino
I see your point, but what if the user inserts into the datetime input
field his/her current time? It will be different from the server's one
(which I set to GMT), and prettydate will not work properly.

I confess that I am a bit confused about that.

Best,
David


On 10 October 2012 11:16, Niphlod  wrote:

> not necessarily wrong, just a different timezone. If you're going to
> display "prettydates" just in the browser for a "nicer visualization" you
> should take into consideration that your server's locatime can be different
> from the users's browser one.
>
> In a "perfect" setup, your server is on GMT (that is, utc), your app uses
> request.utcnow in all the places instead of request.now (and
> datetime.datetime.utcnow() instead of datetime.datetime.utcnow()). You'll
> have prettydate working right.
>
>
> On Wednesday, October 10, 2012 10:38:32 AM UTC+2, David Sorrentino wrote:
>
>> Hey Niphlod,
>>
>> Thank you for your help.
>>
>> The version is 2.0.9 (2012-10-05 09:01:45) dev
>>
>> I tried datetime.datetime.now() in my application and I just discovered
>> that it is 2 hours late. This explains why prettydate is then 2 hours in
>> hurry!
>> The odd thing is that if I open a python console and try
>> datetime.datetime.now(), I get the right time. O_O
>>
>> Something wrong with my server?
>>
>> Cheers,
>> David
>>
>>
>> On 10 October 2012 10:28, Niphlod  wrote:
>>
>>> should calculate the difference between datetime.datetime.now() and your
>>> date. what web2py version are you using ?
>>>
>>>
>>> On Wednesday, October 10, 2012 10:16:24 AM UTC+2, David Sorrentino wrote:
>>>>
>>>> Hello everybody,
>>>>
>>>> I am using the module *prettydate*, but it seems that it matches the
>>>> datetime I give as input with a wrong timezone.
>>>>
>>>> For example now it's 10:12 am at my place.
>>>>
>>>> This is the datetime I give as input: 2012-10-10 10:12:00.
>>>>
>>>> This is the code:
>>>>
>>>> from gluon.tools import prettydate
>>>>> pretty_d = prettydate(input_datetime, T)
>>>>>
>>>>
>>>>
>>>> And this is the result: "2 hours from now".
>>>> It's 2 hours in hurry!! :)
>>>>
>>>> Am I wrong in something?
>>>>
>>>> I wish you a wonderful Wednesday,
>>>> David
>>>>
>>>>
>>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: Prettydate and time zones

2012-10-10 Thread David Sorrentino
Hey Niphlod,

Thank you for your help.

The version is 2.0.9 (2012-10-05 09:01:45) dev

I tried datetime.datetime.now() in my application and I just discovered
that it is 2 hours late. This explains why prettydate is then 2 hours in
hurry!
The odd thing is that if I open a python console and try
datetime.datetime.now(), I get the right time. O_O

Something wrong with my server?

Cheers,
David


On 10 October 2012 10:28, Niphlod  wrote:

> should calculate the difference between datetime.datetime.now() and your
> date. what web2py version are you using ?
>
>
> On Wednesday, October 10, 2012 10:16:24 AM UTC+2, David Sorrentino wrote:
>>
>> Hello everybody,
>>
>> I am using the module *prettydate*, but it seems that it matches the
>> datetime I give as input with a wrong timezone.
>>
>> For example now it's 10:12 am at my place.
>>
>> This is the datetime I give as input: 2012-10-10 10:12:00.
>>
>> This is the code:
>>
>> from gluon.tools import prettydate
>>> pretty_d = prettydate(input_datetime, T)
>>>
>>
>>
>> And this is the result: "2 hours from now".
>> It's 2 hours in hurry!! :)
>>
>> Am I wrong in something?
>>
>> I wish you a wonderful Wednesday,
>> David
>>
>>
>>  --
>
>
>
>

-- 





[web2py] Prettydate and time zones

2012-10-10 Thread David Sorrentino
Hello everybody,

I am using the module *prettydate*, but it seems that it matches the
datetime I give as input with a wrong timezone.

For example now it's 10:12 am at my place.

This is the datetime I give as input: 2012-10-10 10:12:00.

This is the code:

from gluon.tools import prettydate
> pretty_d = prettydate(input_datetime, T)
>


And this is the result: "2 hours from now".
It's 2 hours in hurry!! :)

Am I wrong in something?

I wish you a wonderful Wednesday,
David

-- 





Re: [web2py] Re: SQLFORM.grid + GAE

2012-10-02 Thread David Sorrentino
Fixed in trunk. Thanks Massimo!

Cheers,
David


On 2 October 2012 04:48, Massimo Di Pierro wrote:

> I believe this is fixed in trunk. Can you help test it?
>
>
> On Sunday, 30 September 2012 13:08:10 UTC-5, David Sorrentino wrote:
>
>> Sure I can! ;)
>>
>> Here it is:
>>
>> ERROR2012-09-30 18:04:57,520 restricted.py:54] In FILE:
>>> /home/dapids/webdev/**backinterface/web2py/**applications/backinterface/
>>> **controllers/default.py
>>>
>>> Traceback (most recent call last):
>>>   File "/home/dapids/webdev/**backinterface/web2py/gluon/**restricted.py",
>>> line 209, in restricted
>>> exec ccode in environment
>>>   File "/home/dapids/webdev/**backinterface/web2py/**
>>> applications/backinterface/**controllers/default.py", line 86, in
>>> 
>>>   File "/home/dapids/webdev/**backinterface/web2py/gluon/**globals.py",
>>> line 186, in 
>>> self._caller = lambda f: f()
>>>   File "/home/dapids/webdev/**backinterface/web2py/**
>>> applications/backinterface/**controllers/default.py", line 24, in
>>> editnews
>>> grid = SQLFORM.grid(db.news)
>>>   File "/home/dapids/webdev/**backinterface/web2py/gluon/**sqlhtml.py",
>>> line 2042, in grid
>>> cacheable=True,*table_fields)
>>>   File "/home/dapids/webdev/**backinterface/web2py/gluon/**dal.py",
>>> line 8719, in select
>>> return adapter.select(self.query,**fields,attributes)
>>>   File "/home/dapids/webdev/**backinterface/web2py/gluon/**dal.py",
>>> line 4546, in select
>>> for t in fields] for item in items]
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**ext/db/__init__.py",
>>> line 2082, in __iter__
>>> return self.run()
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**ext/db/__init__.py",
>>> line 2063, in run
>>> raw_query = self._get_query()
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**ext/db/__init__.py",
>>> line 2459, in _get_query
>>> _app=self._app)
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**api/datastore.py",
>>> line 1315, in __init__
>>> self.update(filters)
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**api/datastore.py",
>>> line 1764, in update
>>> self.__setitem__(filter, value)
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**api/datastore.py",
>>> line 1708, in __setitem__
>>> match = self._CheckFilter(filter, value)
>>>   File 
>>> "/home/dapids/google_**appengine/google/appengine/**api/datastore.py",
>>> line 1847, in _CheckFilter
>>> (datastore_types.KEY_SPECIAL_**PROPERTY, value, typename(value)))
>>> BadFilterError: invalid filter: __key__ filter value must be a Key;
>>> received None (a NoneType).
>>>
>>
>> Thanks for your help Massimo.
>>
>> Cheers,
>> David
>>
>>
>> On 30 September 2012 19:40, Massimo Di Pierro wrote:
>>
>>> Can you please post the entire traceback?
>>>
>>> Massimo
>>>
>>>
>>> On Sunday, 30 September 2012 11:52:57 UTC-5, David Sorrentino wrote:
>>>>
>>>> Hi there! :)
>>>>
>>>> I'm trying to exploit the power of SQLFORM.grid with GAE but I'm having
>>>> some troubles.
>>>> All I want to do is to have a grid from a table (seems to be simple
>>>> reading the infinite examples on the web).
>>>>
>>>> Here my table definition:
>>>>
>>>> db.define_table('news',
>>>>> Field('title'),
>>>>> Field('body', 'text')
>>>>> )
>>>>>
>>>>
>>>> Here the controller:
>>>>
>>>> @auth.requires_login()
>>>>> def editnews():
>>>>> grid = SQLFORM.grid(db.news)
>>>>> return dict(grid=grid)
>>>>>
>>>>
>>>> And here the view:
>>>>
>>>>  {{extend 'layout.html'}}
>>>>> {{=grid}}
>>>>>
>>>>
>>>> Unfortunately when I load the view I get this error:
>>>>
>>>> BadFilterError: invalid filter: __key__ filter value must be a Key;
>>>>> received None (a NoneType).
>>>>>
>>>>
>>>> The errors seems to be in the definition of the grid, but I can't
>>>> understand what's wrong.
>>>> Can somebody help me? :)
>>>>
>>>> Cheers,
>>>> David
>>>>
>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Adding cancel button - form submission

2012-10-01 Thread David Sorrentino
No problem! :)

So, is there any method to customize the elements of a form (fields and
buttons) without using a custom form?
Because I managed to customize it with form.custom... but then I can't add
a cancel button.

Thanks a lot! :)
David


On 1 October 2012 22:47, Massimo Di Pierro wrote:

> When you add_button('cancel',) you do not get a form.custom.cancel.
> Sorry.
>
>
> On Monday, 1 October 2012 13:36:02 UTC-5, David Sorrentino wrote:
>>
>> Hi everybody,
>>
>> Sorry for re-opening this thread, but I'm trying without success to add a
>> cancel button to a CRUD form.
>>
>> Here my controller:
>> def insertnews():
>> form = crud.create(db.news)
>> form.add_button("cancel",URL(r**=request,f='index'))
>> return dict(form=form)
>>
>> Here my view:
>> {{=form.custom.begin}}
>> Body:
>> {{=form.custom.widget.**body}}
>> {{=form.custom.submit}}
>> {{=form.custom.cancel}}
>> {{=form.custom.end}}
>>
>> Where am I wrong?
>>
>> Cheers,
>> David
>>
>>
>> On Thursday, 13 September 2012 23:49:01 UTC+2, Massimo Di Pierro wrote:
>>>
>>> +1
>>>
>>> On Thursday, 13 September 2012 12:17:17 UTC-5, Henrik Holm wrote:
>>>>
>>>> Has this "add_button" been added to one of the recent releases?  I'm
>>>> running 1.99.7 and I get
>>>>
>>>>   * 'SQLFORM' object has no
>>>> attribute 'add_button'*
>>>>
>>>> Maybe it's time to upgrade :-)
>>>>
>>>> Thanks,
>>>> Henrik
>>>>
>>>>
>>>> On Tuesday, July 17, 2012 1:43:08 PM UTC-4, Massimo Di Pierro wrote:
>>>>>
>>>>> In trunk:
>>>>>
>>>>> form.add_button("Cancel",URL(**r=request,f='new_contact'))
>>>>>
>>>>> On Tuesday, 17 July 2012 10:00:59 UTC-5, Mathias wrote:
>>>>>>
>>>>>> I found a good solution for me :
>>>>>>
>>>>>> form[0][-1][1].append(TAG.**INPUT(_value='Cancel',_type="**
>>>>>> button",_onclick="window.**location='%s';"%URL(r=request,**f='new_contact')))
>>>>>>
>>>>>>
>>>>>> Mathias
>>>>>>
>>>>>>
>>>>>> 2012/7/17 Mathias Van Daele :
>>>>>> > Thanks for your solution Richard !
>>>>>> >
>>>>>> > I am still looking for a solution with a button component...
>>>>>> >
>>>>>> > Mathias
>>>>>> >
>>>>>> > 2012/7/17 Richard Vézina :
>>>>>> >> Maybe this could be enough??
>>>>>> >>
>>>>>> >> {{=A(T('cancel'),_href="**javascript:void(history.go(-1)**)")}}
>>>>>> >>
>>>>>> >> It will bring you back to the precedent page, in my use case, I
>>>>>> direct the
>>>>>> >> user on a crud.read page where the user can edit the record
>>>>>> (crud.update).
>>>>>> >> Then if don't want make change anymore there is a "cancel"
>>>>>> hyperlink that
>>>>>> >> bring back the user on the crud.read page.
>>>>>> >>
>>>>>> >> Richard
>>>>>> >>
>>>>>> >>
>>>>>> >> On Tue, Jul 17, 2012 at 8:13 AM, Mathias 
>>>>>> wrote:
>>>>>> >>>
>>>>>> >>> Hello,
>>>>>> >>>
>>>>>> >>> I have added a CANCEL button to my SQLFORM.
>>>>>> >>>
>>>>>> >>> Form submission prevents the correct working of it.
>>>>>> >>>
>>>>>> >>> I have tried to avoid form submission with this code :
>>>>>> >>>
>>>>>> >>>
>>>>>> >>> def new_guest_contact():
>>>>>> >>>form = SQLFORM.factory(...)
>>>>>> >>>
>>>>>> >>>
>>>>>> >>> form[0][-1][1].append(TAG.**BUTTON('Cancel',_onclick='**ajax("%s",[],":eval");return
>>>>>>
>>>>>> >>> false' %URL(r=request,f='new_contact'**)))
>>>>>> >>>
>>>>>> >>>if form.process().accepted:
>>>>>> >>> ...
>>>>>> >>> redirect(URL(r=request,f='new_**contact_part'))
>>>>>> >>>elif form.errors:
>>>>>> >>>response.flash = 'form has errors'
>>>>>> >>>else:
>>>>>> >>>response.flash = 'Create new guest'
>>>>>> >>>
>>>>>> >>>return dict(form=form)
>>>>>> >>>
>>>>>> >>>
>>>>>> >>> If I click the cancel button now, nothing happens anymore.
>>>>>> >>>
>>>>>> >>>
>>>>>> >>> Any help is welcome.
>>>>>> >>>
>>>>>> >>> Thanks
>>>>>> >>>
>>>>>> >>>
>>>>>> >>> Mathias
>>>>>> >>>
>>>>>> >>> --
>>>>>> >>>
>>>>>> >>>
>>>>>> >>>
>>>>>> >>
>>>>>> >>
>>>>>> >> --
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>>
>>>>>  --
>
>
>
>

-- 





Re: [web2py] Adding cancel button - form submission

2012-10-01 Thread David Sorrentino
Hi everybody,

Sorry for re-opening this thread, but I'm trying without success to add a 
cancel button to a CRUD form.

Here my controller:
def insertnews():
form = crud.create(db.news)
form.add_button("cancel",URL(r=request,f='index'))
return dict(form=form)

Here my view:
{{=form.custom.begin}}
Body:
{{=form.custom.widget.body}}
{{=form.custom.submit}}
{{=form.custom.cancel}}
{{=form.custom.end}}

Where am I wrong?

Cheers,
David


On Thursday, 13 September 2012 23:49:01 UTC+2, Massimo Di Pierro wrote:
>
> +1
>
> On Thursday, 13 September 2012 12:17:17 UTC-5, Henrik Holm wrote:
>>
>> Has this "add_button" been added to one of the recent releases?  I'm 
>> running 1.99.7 and I get 
>>
>>   * 'SQLFORM' object has no attribute 
>> 'add_button'*
>>
>> Maybe it's time to upgrade :-)
>>
>> Thanks,
>> Henrik
>>
>>
>> On Tuesday, July 17, 2012 1:43:08 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> In trunk:
>>>
>>> form.add_button("Cancel",URL(r=request,f='new_contact'))
>>>
>>> On Tuesday, 17 July 2012 10:00:59 UTC-5, Mathias wrote:

 I found a good solution for me : 

 form[0][-1][1].append(TAG.INPUT(_value='Cancel',_type="button",_onclick="window.location='%s';"%URL(r=request,f='new_contact')))
  


 Mathias 


 2012/7/17 Mathias Van Daele : 
 > Thanks for your solution Richard ! 
 > 
 > I am still looking for a solution with a button component... 
 > 
 > Mathias 
 > 
 > 2012/7/17 Richard Vézina : 
 >> Maybe this could be enough?? 
 >> 
 >> {{=A(T('cancel'),_href="javascript:void(history.go(-1))")}} 
 >> 
 >> It will bring you back to the precedent page, in my use case, I 
 direct the 
 >> user on a crud.read page where the user can edit the record 
 (crud.update). 
 >> Then if don't want make change anymore there is a "cancel" hyperlink 
 that 
 >> bring back the user on the crud.read page. 
 >> 
 >> Richard 
 >> 
 >> 
 >> On Tue, Jul 17, 2012 at 8:13 AM, Mathias  
 wrote: 
 >>> 
 >>> Hello, 
 >>> 
 >>> I have added a CANCEL button to my SQLFORM. 
 >>> 
 >>> Form submission prevents the correct working of it. 
 >>> 
 >>> I have tried to avoid form submission with this code : 
 >>> 
 >>> 
 >>> def new_guest_contact(): 
 >>>form = SQLFORM.factory(...) 
 >>> 
 >>> 
 >>> 
 form[0][-1][1].append(TAG.BUTTON('Cancel',_onclick='ajax("%s",[],":eval");return
  

 >>> false' %URL(r=request,f='new_contact'))) 
 >>> 
 >>>if form.process().accepted: 
 >>> ... 
 >>> redirect(URL(r=request,f='new_contact_part')) 
 >>>elif form.errors: 
 >>>response.flash = 'form has errors' 
 >>>else: 
 >>>response.flash = 'Create new guest' 
 >>> 
 >>>return dict(form=form) 
 >>> 
 >>> 
 >>> If I click the cancel button now, nothing happens anymore. 
 >>> 
 >>> 
 >>> Any help is welcome. 
 >>> 
 >>> Thanks 
 >>> 
 >>> 
 >>> Mathias 
 >>> 
 >>> -- 
 >>> 
 >>> 
 >>> 
 >> 
 >> 
 >> -- 
 >> 
 >> 
 >> 

>>>

-- 





Re: [web2py] Re: SQLFORM.grid + GAE

2012-09-30 Thread David Sorrentino
Sure I can! ;)

Here it is:

ERROR2012-09-30 18:04:57,520 restricted.py:54] In FILE:
> /home/dapids/webdev/backinterface/web2py/applications/backinterface/controllers/default.py
>
> Traceback (most recent call last):
>   File "/home/dapids/webdev/backinterface/web2py/gluon/restricted.py",
> line 209, in restricted
> exec ccode in environment
>   File
> "/home/dapids/webdev/backinterface/web2py/applications/backinterface/controllers/default.py",
> line 86, in 
>   File "/home/dapids/webdev/backinterface/web2py/gluon/globals.py", line
> 186, in 
> self._caller = lambda f: f()
>   File
> "/home/dapids/webdev/backinterface/web2py/applications/backinterface/controllers/default.py",
> line 24, in editnews
> grid = SQLFORM.grid(db.news)
>   File "/home/dapids/webdev/backinterface/web2py/gluon/sqlhtml.py", line
> 2042, in grid
> cacheable=True,*table_fields)
>   File "/home/dapids/webdev/backinterface/web2py/gluon/dal.py", line 8719,
> in select
> return adapter.select(self.query,fields,attributes)
>   File "/home/dapids/webdev/backinterface/web2py/gluon/dal.py", line 4546,
> in select
> for t in fields] for item in items]
>   File
> "/home/dapids/google_appengine/google/appengine/ext/db/__init__.py", line
> 2082, in __iter__
> return self.run()
>   File
> "/home/dapids/google_appengine/google/appengine/ext/db/__init__.py", line
> 2063, in run
> raw_query = self._get_query()
>   File
> "/home/dapids/google_appengine/google/appengine/ext/db/__init__.py", line
> 2459, in _get_query
> _app=self._app)
>   File "/home/dapids/google_appengine/google/appengine/api/datastore.py",
> line 1315, in __init__
> self.update(filters)
>   File "/home/dapids/google_appengine/google/appengine/api/datastore.py",
> line 1764, in update
> self.__setitem__(filter, value)
>   File "/home/dapids/google_appengine/google/appengine/api/datastore.py",
> line 1708, in __setitem__
> match = self._CheckFilter(filter, value)
>   File "/home/dapids/google_appengine/google/appengine/api/datastore.py",
> line 1847, in _CheckFilter
> (datastore_types.KEY_SPECIAL_PROPERTY, value, typename(value)))
> BadFilterError: invalid filter: __key__ filter value must be a Key;
> received None (a NoneType).
>

Thanks for your help Massimo.

Cheers,
David


On 30 September 2012 19:40, Massimo Di Pierro wrote:

> Can you please post the entire traceback?
>
> Massimo
>
>
> On Sunday, 30 September 2012 11:52:57 UTC-5, David Sorrentino wrote:
>>
>> Hi there! :)
>>
>> I'm trying to exploit the power of SQLFORM.grid with GAE but I'm having
>> some troubles.
>> All I want to do is to have a grid from a table (seems to be simple
>> reading the infinite examples on the web).
>>
>> Here my table definition:
>>
>> db.define_table('news',
>>> Field('title'),
>>> Field('body', 'text')
>>> )
>>>
>>
>> Here the controller:
>>
>> @auth.requires_login()
>>> def editnews():
>>> grid = SQLFORM.grid(db.news)
>>> return dict(grid=grid)
>>>
>>
>> And here the view:
>>
>>  {{extend 'layout.html'}}
>>> {{=grid}}
>>>
>>
>> Unfortunately when I load the view I get this error:
>>
>> BadFilterError: invalid filter: __key__ filter value must be a Key;
>>> received None (a NoneType).
>>>
>>
>> The errors seems to be in the definition of the grid, but I can't
>> understand what's wrong.
>> Can somebody help me? :)
>>
>> Cheers,
>> David
>>
>  --
>
>
>
>

-- 





[web2py] SQLFORM.grid + GAE

2012-09-30 Thread David Sorrentino
Hi there! :)

I'm trying to exploit the power of SQLFORM.grid with GAE but I'm having
some troubles.
All I want to do is to have a grid from a table (seems to be simple reading
the infinite examples on the web).

Here my table definition:

db.define_table('news',
> Field('title'),
> Field('body', 'text')
> )
>

Here the controller:

@auth.requires_login()
> def editnews():
> grid = SQLFORM.grid(db.news)
> return dict(grid=grid)
>

And here the view:

 {{extend 'layout.html'}}
> {{=grid}}
>

Unfortunately when I load the view I get this error:

BadFilterError: invalid filter: __key__ filter value must be a Key;
> received None (a NoneType).
>

The errors seems to be in the definition of the grid, but I can't
understand what's wrong.
Can somebody help me? :)

Cheers,
David

-- 





Re: [web2py] Re: Presentations + IOError: [Errno 13] with google appengine

2012-09-19 Thread David Sorrentino
Man, you got the point. :)
I was running web2py with 2.7 and then I tried the SDK with 2.5. Of course
I created a kind of conflict.
Cleaning the whole web2py from the pyc files and launching the SDK with
python 2.5 worked perfectly! :)

I still do not know why on archlinux I cannot develop with python 2.7
whereas I can on ubuntu.
If I find the reason out, I will let you know.

Thank you again Massimo. You solved another issue today! :)

A nice Wednesday to everybody!
David


On 18 September 2012 23:30, Massimo Di Pierro wrote:

> I think the problem is that you are running web2py with 2.7 and the sdk
> with 2.5. I suspect when 2.5 finds the pyc created with 2.7 it complains.
> GAE does not complain because the pyc are not deployed. Try delete all the
> pyc files, restart the SDK and it should not complain.
>
>
> On Tuesday, 18 September 2012 14:10:52 UTC-5, David Sorrentino wrote:
>
>> Oddly enough I'm getting these WARNING/ERRORS just with the SDK. I
>> checked the logs of the GAE and they are cleaned. ;)
>>
>> Yes, all of them are related to the content of the folder *plural_rules*.
>> Yes, it looks like they are always the same files.
>>
>> Appengine is giving me some lemons, but I'm not gonna give up! :)
>>
>> Thank you for your help Massimo.
>>
>> Cheers,
>> David
>>
>>
>> On 18 September 2012 20:22, Massimo Di Pierro wrote:
>>
>>> Strange. Are you getting the errors with the SDK or GAE or both? Are
>>> most of the errors for pyc files or files in plural_rules? does it look
>>> they are always the same files?
>>>
>>> On Tuesday, 18 September 2012 11:08:44 UTC-5, David Sorrentino wrote:
>>>
>>>> Apparently it is.
>>>> Just tried with python 2.5 and it seems to work.
>>>> I just get an avalanche of warnings every time a load a page.
>>>>
>>>> Here an instance:
>>>> http://pastebin.com/MPZVS1FM
>>>>
>>>> Do you know why all this mess happens? Is it related to the handler
>>>> defined in app.yaml? I used the one present in the scaffolding.
>>>>
>>>> Thank you for your help, and thank you very much for all the work you
>>>> did so far. It's impressive! :)
>>>>
>>>> Cheers,
>>>> David
>>>>
>>>>
>>>> On 18 September 2012 17:01, Massimo Di Pierro wrote:
>>>>
>>>>> Could this be a problem of 2.5 vs 2.7? Have you tried 2.5?
>>>>>
>>>>>
>>>>> On Tuesday, 18 September 2012 04:20:16 UTC-5, David Sorrentino wrote:
>>>>>>
>>>>>> Hi everybody!
>>>>>>
>>>>>> My name is David and I started "playing" with web2py few days ago. My
>>>>>> first impression is definitely positive and I hope to start soon
>>>>>> contributing to this wonderful community!
>>>>>>
>>>>>> Yesterday I built my first app and deployed it with nginx. Works like
>>>>>> a charm! :D
>>>>>> So, today I wanted to try google appengine. Everything seemed to be
>>>>>> working fine, but as soon as I performed a connection to the database I 
>>>>>> got
>>>>>> this error from dev_appserver.py:
>>>>>>
>>>>>> WARNING  2012-09-18 08:37:03,329 py_zipimport.py:139] Can't open
>>>>>>> zipfile 
>>>>>>> /usr/lib/python2.7/site-**packages/setuptools-0.6c11.**egg-info:
>>>>>>> IOError: [Errno 13] file not accessible: '/usr/lib/python2.7/site-**
>>>>>>> packages/setuptools-0.6c11.**egg-**info**'
>>>>>>> WARNING  2012-09-18 08:37:03,860 dev_appserver_import_hook.py:**5***
>>>>>>> *46] Blocking access to skipped file "/home/david/WebDevelopment/**
>>>>>>> content-manager/web2py/gluon/**rocket.py"
>>>>>>>
>>>>>>
>>>>>> Looks like it can't access *setuptools-0.6c11.egg-info*, but such
>>>>>> file is there and its permissions are OK.
>>>>>> Obviously, the connection to the database doesn't work.
>>>>>>
>>>>>> So, I edited *dev_appserver_import_hook.py *and changed:
>>>>>>
>>>>>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>>>>>> py27_optional=False):
>>>>>>>
>>>>>>
>>>>>> in:
>>>>>>
>>>>>>>
>>>>>>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>>>>>> py27_optional=True):
>>>>>>>
>>>>>>
>>>>>> and I got this different error (related to the same origin but imho
>>>>>> more specific):
>>>>>>
>>>>>> WARNING  2012-09-18 09:04:39,300 py_zipimport.py:139] Can't open
>>>>>>> zipfile 
>>>>>>> /usr/lib/python2.7/site-**packages/setuptools-0.6c11.**egg-info:
>>>>>>> BadZipfile: File is not a zip file
>>>>>>> ...
>>>>>>>
>>>>>>
>>>>>> Looks like it's looking for a ZIP file and of course *
>>>>>> setuptools-0.6c11.egg-info* is not. O_o
>>>>>> Operating system: archlinux.
>>>>>>
>>>>>> Any hints? Tell me if you need more specific information.
>>>>>>
>>>>>>
>>>>>> I wish everybody a wonderful Tuesday!
>>>>>> David
>>>>>>
>>>>>  --
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: Presentations + IOError: [Errno 13] with google appengine

2012-09-18 Thread David Sorrentino
Just tried on my ubuntu server and everything works super fine, both with
python 2.5 and 2.7.
I also tried a "vanilla" version of archlinux on a virtual machine and
nothing changed.
I don't know why, but seems like archlinux doesn't like the appengine SDK.
:P

However, perhaps it's not the best solution ever, but for now I'm going to
develop my apps by running the appserver remotely on the ubuntu server.
Meanwhile, I'm gonna keep on looking for a solution for my poor arch. :)

Thank you one more time for your time and support Massimo!

Cheers,
David


On 18 September 2012 21:10, David Sorrentino wrote:

> Oddly enough I'm getting these WARNING/ERRORS just with the SDK. I checked
> the logs of the GAE and they are cleaned. ;)
>
> Yes, all of them are related to the content of the folder *plural_rules*.
> Yes, it looks like they are always the same files.
>
> Appengine is giving me some lemons, but I'm not gonna give up! :)
>
> Thank you for your help Massimo.
>
> Cheers,
> David
>
>
>
> On 18 September 2012 20:22, Massimo Di Pierro 
> wrote:
>
>> Strange. Are you getting the errors with the SDK or GAE or both? Are most
>> of the errors for pyc files or files in plural_rules? does it look they are
>> always the same files?
>>
>> On Tuesday, 18 September 2012 11:08:44 UTC-5, David Sorrentino wrote:
>>
>>> Apparently it is.
>>> Just tried with python 2.5 and it seems to work.
>>> I just get an avalanche of warnings every time a load a page.
>>>
>>> Here an instance:
>>> http://pastebin.com/MPZVS1FM
>>>
>>> Do you know why all this mess happens? Is it related to the handler
>>> defined in app.yaml? I used the one present in the scaffolding.
>>>
>>> Thank you for your help, and thank you very much for all the work you
>>> did so far. It's impressive! :)
>>>
>>> Cheers,
>>> David
>>>
>>>
>>> On 18 September 2012 17:01, Massimo Di Pierro wrote:
>>>
>>>> Could this be a problem of 2.5 vs 2.7? Have you tried 2.5?
>>>>
>>>>
>>>> On Tuesday, 18 September 2012 04:20:16 UTC-5, David Sorrentino wrote:
>>>>>
>>>>> Hi everybody!
>>>>>
>>>>> My name is David and I started "playing" with web2py few days ago. My
>>>>> first impression is definitely positive and I hope to start soon
>>>>> contributing to this wonderful community!
>>>>>
>>>>> Yesterday I built my first app and deployed it with nginx. Works like
>>>>> a charm! :D
>>>>> So, today I wanted to try google appengine. Everything seemed to be
>>>>> working fine, but as soon as I performed a connection to the database I 
>>>>> got
>>>>> this error from dev_appserver.py:
>>>>>
>>>>> WARNING  2012-09-18 08:37:03,329 py_zipimport.py:139] Can't open
>>>>>> zipfile 
>>>>>> /usr/lib/python2.7/site-**packag**es/setuptools-0.6c11.**egg-info:
>>>>>> IOError: [Errno 13] file not accessible: '/usr/lib/python2.7/site-**
>>>>>> packa**ges/setuptools-0.6c11.**egg-**info'
>>>>>> WARNING  2012-09-18 08:37:03,860 dev_appserver_import_hook.py:**5**46]
>>>>>> Blocking access to skipped file "/home/david/WebDevelopment/**co**
>>>>>> ntent-manager/web2py/gluon/**roc**ket.py"
>>>>>>
>>>>>
>>>>> Looks like it can't access *setuptools-0.6c11.egg-info*, but such
>>>>> file is there and its permissions are OK.
>>>>> Obviously, the connection to the database doesn't work.
>>>>>
>>>>> So, I edited *dev_appserver_import_hook.py *and changed:
>>>>>
>>>>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>>>>> py27_optional=False):
>>>>>>
>>>>>
>>>>> in:
>>>>>
>>>>>>
>>>>>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>>>>> py27_optional=True):
>>>>>>
>>>>>
>>>>> and I got this different error (related to the same origin but imho
>>>>> more specific):
>>>>>
>>>>> WARNING  2012-09-18 09:04:39,300 py_zipimport.py:139] Can't open
>>>>>> zipfile 
>>>>>> /usr/lib/python2.7/site-**packag**es/setuptools-0.6c11.**egg-info:
>>>>>> BadZipfile: File is not a zip file
>>>>>> ...
>>>>>>
>>>>>
>>>>> Looks like it's looking for a ZIP file and of course *
>>>>> setuptools-0.6c11.egg-info* is not. O_o
>>>>> Operating system: archlinux.
>>>>>
>>>>> Any hints? Tell me if you need more specific information.
>>>>>
>>>>>
>>>>> I wish everybody a wonderful Tuesday!
>>>>> David
>>>>>
>>>>  --
>>>>
>>>>
>>>>
>>>>
>>>
>>>  --
>>
>>
>>
>>
>
>

-- 





Re: [web2py] Re: Presentations + IOError: [Errno 13] with google appengine

2012-09-18 Thread David Sorrentino
Oddly enough I'm getting these WARNING/ERRORS just with the SDK. I checked
the logs of the GAE and they are cleaned. ;)

Yes, all of them are related to the content of the folder *plural_rules*.
Yes, it looks like they are always the same files.

Appengine is giving me some lemons, but I'm not gonna give up! :)

Thank you for your help Massimo.

Cheers,
David


On 18 September 2012 20:22, Massimo Di Pierro wrote:

> Strange. Are you getting the errors with the SDK or GAE or both? Are most
> of the errors for pyc files or files in plural_rules? does it look they are
> always the same files?
>
> On Tuesday, 18 September 2012 11:08:44 UTC-5, David Sorrentino wrote:
>
>> Apparently it is.
>> Just tried with python 2.5 and it seems to work.
>> I just get an avalanche of warnings every time a load a page.
>>
>> Here an instance:
>> http://pastebin.com/MPZVS1FM
>>
>> Do you know why all this mess happens? Is it related to the handler
>> defined in app.yaml? I used the one present in the scaffolding.
>>
>> Thank you for your help, and thank you very much for all the work you did
>> so far. It's impressive! :)
>>
>> Cheers,
>> David
>>
>>
>> On 18 September 2012 17:01, Massimo Di Pierro wrote:
>>
>>> Could this be a problem of 2.5 vs 2.7? Have you tried 2.5?
>>>
>>>
>>> On Tuesday, 18 September 2012 04:20:16 UTC-5, David Sorrentino wrote:
>>>>
>>>> Hi everybody!
>>>>
>>>> My name is David and I started "playing" with web2py few days ago. My
>>>> first impression is definitely positive and I hope to start soon
>>>> contributing to this wonderful community!
>>>>
>>>> Yesterday I built my first app and deployed it with nginx. Works like a
>>>> charm! :D
>>>> So, today I wanted to try google appengine. Everything seemed to be
>>>> working fine, but as soon as I performed a connection to the database I got
>>>> this error from dev_appserver.py:
>>>>
>>>> WARNING  2012-09-18 08:37:03,329 py_zipimport.py:139] Can't open
>>>>> zipfile /usr/lib/python2.7/site-**packag**es/setuptools-0.6c11.**egg-info:
>>>>> IOError: [Errno 13] file not accessible: '/usr/lib/python2.7/site-**
>>>>> packa**ges/setuptools-0.6c11.**egg-**info'
>>>>> WARNING  2012-09-18 08:37:03,860 dev_appserver_import_hook.py:**5**46]
>>>>> Blocking access to skipped file "/home/david/WebDevelopment/**co**
>>>>> ntent-manager/web2py/gluon/**roc**ket.py"
>>>>>
>>>>
>>>> Looks like it can't access *setuptools-0.6c11.egg-info*, but such file
>>>> is there and its permissions are OK.
>>>> Obviously, the connection to the database doesn't work.
>>>>
>>>> So, I edited *dev_appserver_import_hook.py *and changed:
>>>>
>>>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>>>> py27_optional=False):
>>>>>
>>>>
>>>> in:
>>>>
>>>>>
>>>>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>>>> py27_optional=True):
>>>>>
>>>>
>>>> and I got this different error (related to the same origin but imho
>>>> more specific):
>>>>
>>>> WARNING  2012-09-18 09:04:39,300 py_zipimport.py:139] Can't open
>>>>> zipfile /usr/lib/python2.7/site-**packag**es/setuptools-0.6c11.**egg-info:
>>>>> BadZipfile: File is not a zip file
>>>>> ...
>>>>>
>>>>
>>>> Looks like it's looking for a ZIP file and of course *
>>>> setuptools-0.6c11.egg-info* is not. O_o
>>>> Operating system: archlinux.
>>>>
>>>> Any hints? Tell me if you need more specific information.
>>>>
>>>>
>>>> I wish everybody a wonderful Tuesday!
>>>> David
>>>>
>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: Presentations + IOError: [Errno 13] with google appengine

2012-09-18 Thread David Sorrentino
Apparently it is.
Just tried with python 2.5 and it seems to work.
I just get an avalanche of warnings every time a load a page.

Here an instance:
http://pastebin.com/MPZVS1FM

Do you know why all this mess happens? Is it related to the handler defined
in app.yaml? I used the one present in the scaffolding.

Thank you for your help, and thank you very much for all the work you did
so far. It's impressive! :)

Cheers,
David


On 18 September 2012 17:01, Massimo Di Pierro wrote:

> Could this be a problem of 2.5 vs 2.7? Have you tried 2.5?
>
>
> On Tuesday, 18 September 2012 04:20:16 UTC-5, David Sorrentino wrote:
>>
>> Hi everybody!
>>
>> My name is David and I started "playing" with web2py few days ago. My
>> first impression is definitely positive and I hope to start soon
>> contributing to this wonderful community!
>>
>> Yesterday I built my first app and deployed it with nginx. Works like a
>> charm! :D
>> So, today I wanted to try google appengine. Everything seemed to be
>> working fine, but as soon as I performed a connection to the database I got
>> this error from dev_appserver.py:
>>
>> WARNING  2012-09-18 08:37:03,329 py_zipimport.py:139] Can't open zipfile
>>> /usr/lib/python2.7/site-**packages/setuptools-0.6c11.**egg-info:
>>> IOError: [Errno 13] file not accessible: '/usr/lib/python2.7/site-**
>>> packages/setuptools-0.6c11.**egg-info'
>>> WARNING  2012-09-18 08:37:03,860 dev_appserver_import_hook.py:**546]
>>> Blocking access to skipped file "/home/david/WebDevelopment/**
>>> content-manager/web2py/gluon/**rocket.py"
>>>
>>
>> Looks like it can't access *setuptools-0.6c11.egg-info*, but such file
>> is there and its permissions are OK.
>> Obviously, the connection to the database doesn't work.
>>
>> So, I edited *dev_appserver_import_hook.py *and changed:
>>
>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>> py27_optional=False):
>>>
>>
>> in:
>>
>>>
>>> def IsFileAccessible(filename, normcase=os.path.normcase,
>>> py27_optional=True):
>>>
>>
>> and I got this different error (related to the same origin but imho more
>> specific):
>>
>> WARNING  2012-09-18 09:04:39,300 py_zipimport.py:139] Can't open zipfile
>>> /usr/lib/python2.7/site-**packages/setuptools-0.6c11.**egg-info:
>>> BadZipfile: File is not a zip file
>>> ...
>>>
>>
>> Looks like it's looking for a ZIP file and of course *
>> setuptools-0.6c11.egg-info* is not. O_o
>> Operating system: archlinux.
>>
>> Any hints? Tell me if you need more specific information.
>>
>>
>> I wish everybody a wonderful Tuesday!
>> David
>>
>  --
>
>
>
>

-- 





[web2py] Presentations + IOError: [Errno 13] with google appengine

2012-09-18 Thread David Sorrentino
Hi everybody!

My name is David and I started "playing" with web2py few days ago. My first
impression is definitely positive and I hope to start soon contributing to
this wonderful community!

Yesterday I built my first app and deployed it with nginx. Works like a
charm! :D
So, today I wanted to try google appengine. Everything seemed to be working
fine, but as soon as I performed a connection to the database I got this
error from dev_appserver.py:

WARNING  2012-09-18 08:37:03,329 py_zipimport.py:139] Can't open zipfile
> /usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-info: IOError:
> [Errno 13] file not accessible:
> '/usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-info'
> WARNING  2012-09-18 08:37:03,860 dev_appserver_import_hook.py:546]
> Blocking access to skipped file
> "/home/david/WebDevelopment/content-manager/web2py/gluon/rocket.py"
>

Looks like it can't access *setuptools-0.6c11.egg-info*, but such file is
there and its permissions are OK.
Obviously, the connection to the database doesn't work.

So, I edited *dev_appserver_import_hook.py *and changed:

def IsFileAccessible(filename, normcase=os.path.normcase,
> py27_optional=False):
>

in:

>
> def IsFileAccessible(filename, normcase=os.path.normcase,
> py27_optional=True):
>

and I got this different error (related to the same origin but imho more
specific):

WARNING  2012-09-18 09:04:39,300 py_zipimport.py:139] Can't open zipfile
> /usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-info: BadZipfile:
> File is not a zip file
> ...
>

Looks like it's looking for a ZIP file and of course *
setuptools-0.6c11.egg-info* is not. O_o
Operating system: archlinux.

Any hints? Tell me if you need more specific information.


I wish everybody a wonderful Tuesday!
David

-- 





Re: [web2py] Re: How to login to Web2Py-app by providing username and password in URL?

2012-09-12 Thread David Sorrentino
>
> Security is clearly not at the top of your agenda :)
>

LoL


On 12 September 2012 14:09, villas  wrote:

> Security is clearly not at the top of your agenda :)
> Something like this might work:
>
> def logmein():
> # minimal, insecure login function
> auth.login_bare(request.vars['username'],request.vars['password'])
>
> yoursite.com/yourapp/default/logmein?username=abc&password=xyz
>
>
>
>
> On Wednesday, September 12, 2012 12:40:13 PM UTC+1, Remco K wrote:
>>
>> Hello everyone,
>>
>> I'm not a big fan of asking questions rather than find solutions by
>> myself but i need a little help on this one so i hope someone can help me a
>> bit.
>>
>> What i need is 'very simple'. I have a Web2Py application running and i
>> need other applications (PHP or something) to be able to successfully login
>> users to this app by providing the username and password via the URL.
>>
>> When doing this in PHP i would think of something like:
>>
>> /index.php?username=blabla&pas**sword=dfgfdjkldfgjk
>>
>> I've already looked at basic auth but i can't get the user to login.
>>
>> All of my controllers/functions use
>> @auth.requires_login()
>> to check whether the user has the permission to execute the functions.
>>
>> I hope someone can help me out on this.
>>
>> Thanks in advance!
>> Remco
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Pynes notify

2012-09-12 Thread David Sorrentino
Impressive.

On 12 September 2012 08:40, Bruno Rocha  wrote:

> This plugin for Bootstrap looks very nice for response.flash
>
> http://pinesframework.org/pnotify/
>
>
>  --
>
>
>
>

--