[web2py] File generation using web2py

2012-04-28 Thread rahulserver
I wish to generate a few reports in csv or txt or other file formats based 
on some database data maintained through a crud application. Previously, it 
was done through an asp.net application with vb as scripting language.But 
as I explored the wonderful capabilities of web2py, I have become a fan of 
this terrific framework.
Is it possible to do it in web2py. And if it is, then how and where should 
the code be placed.In the view or model or controller?


Re: [web2py] Digest for web2py@googlegroups.com - 16 Messages in 9 Topics

2012-04-28 Thread Rinu Boney



Re: [web2py] date type field issue with db.tablename.fieldname.default = request.vars.fieldname

2012-04-28 Thread Massimo Di Pierro
Please open a ticket about this. It should be done automagically.

On Friday, 27 April 2012 15:03:56 UTC-5, Richard wrote:
>
> Solved : datetime.datetime.strptime(request.vars.test_date, 
> '%Y-%m-%d').date()
>
> On Fri, Apr 27, 2012 at 3:09 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello,
>>
>> I get :  'str' object has no attribute 'year'
>>
>> Try to solve it like this without success :
>>
>> db[request.args(0)].test_date.default = 
>> datetime.date(*tuple(request.vars.test_date.split('-')))
>>
>> Then it ask for integer...
>>
>> Richard
>>
>
>
On Friday, 27 April 2012 15:03:56 UTC-5, Richard wrote:
>
> Solved : datetime.datetime.strptime(request.vars.test_date, 
> '%Y-%m-%d').date()
>
> On Fri, Apr 27, 2012 at 3:09 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello,
>>
>> I get :  'str' object has no attribute 'year'
>>
>> Try to solve it like this without success :
>>
>> db[request.args(0)].test_date.default = 
>> datetime.date(*tuple(request.vars.test_date.split('-')))
>>
>> Then it ask for integer...
>>
>> Richard
>>
>
>
On Friday, 27 April 2012 15:03:56 UTC-5, Richard wrote:
>
> Solved : datetime.datetime.strptime(request.vars.test_date, 
> '%Y-%m-%d').date()
>
> On Fri, Apr 27, 2012 at 3:09 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello,
>>
>> I get :  'str' object has no attribute 'year'
>>
>> Try to solve it like this without success :
>>
>> db[request.args(0)].test_date.default = 
>> datetime.date(*tuple(request.vars.test_date.split('-')))
>>
>> Then it ask for integer...
>>
>> Richard
>>
>
>
On Friday, 27 April 2012 15:03:56 UTC-5, Richard wrote:
>
> Solved : datetime.datetime.strptime(request.vars.test_date, 
> '%Y-%m-%d').date()
>
> On Fri, Apr 27, 2012 at 3:09 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello,
>>
>> I get :  'str' object has no attribute 'year'
>>
>> Try to solve it like this without success :
>>
>> db[request.args(0)].test_date.default = 
>> datetime.date(*tuple(request.vars.test_date.split('-')))
>>
>> Then it ask for integer...
>>
>> Richard
>>
>
>

[web2py] Reloading modules

2012-04-28 Thread Yarin
For dev purposes, it would be nice to be able to reload modules without 
having to restart the server- or to have a setting that automatically 
reloads on each request- Otherwise it's almost impossible to do active 
module development from within web2py.

[web2py] Re: Reloading modules

2012-04-28 Thread simon
from gluon.custom_import import track_changes; track_changes(True)

On Saturday, 28 April 2012 14:43:42 UTC+1, Yarin wrote:
>
> For dev purposes, it would be nice to be able to reload modules without 
> having to restart the server- or to have a setting that automatically 
> reloads on each request- Otherwise it's almost impossible to do active 
> module development from within web2py.



[web2py] Re: Reloading modules

2012-04-28 Thread Anthony
On Saturday, April 28, 2012 10:24:21 AM UTC-4, simon wrote:
>
> from gluon.custom_import import track_changes; track_changes(True)


 And note that only reloads when the module changes, not on every request.

Anthony 


Re: [web2py] String EOF error

2012-04-28 Thread Bruce Wade
No suggestions on how to fix this? Everytime I go to admin -> application
-> errors I get this.

On Thu, Apr 26, 2012 at 8:05 AM, Bruce Wade  wrote:

> Yes I use pickle for my adviewer but that works without a problem. and we
> can view all pages. I will look at the link you sent now
>
>
> On Thu, Apr 26, 2012 at 7:54 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Maybe related :
>> https://groups.google.com/forum/?fromgroups#!topic/web2py/3VOr81wpP94
>>
>>
>> On Thu, Apr 26, 2012 at 10:53 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Ok, but do you use pikled object in your app?
>>>
>>> If so, it could come from your code.
>>>
>>> There is maybe broken stuff in web2py, I saw mail passing on the list
>>> about pickle that could not work properly in newer version or in some
>>> circonstance, don't remember...
>>>
>>> I don't know I just try to help.
>>>
>>> Richard
>>>
>>>
>>> On Thu, Apr 26, 2012 at 10:28 AM, Bruce Wade wrote:
>>>
 Yeah except this is an issue with web2py I can't even view my apps
 error page as I just get that message now every time.However when viewing
 my site normally there is no problems

 On Thu, Apr 26, 2012 at 7:06 AM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> May help?!
>
> http://bytes.com/topic/python/answers/36704-graceful-adetection-eof
>
> Richard
>
>
> On Wed, Apr 25, 2012 at 5:29 PM, Bruce Wade wrote:
>
>> Hi I randomly get a EOFError this doesn't always happen and I have no 
>> idea what is causing it.
>>
>> Traceback (most recent call last):
>>
>>
>>
>>
>>
>>
>>   File "/home/developer/projects/yaw/gluon/restricted.py", line 205, in 
>> restricted
>>
>>
>>
>>
>>
>>
>> exec ccode in environment
>>
>>
>>
>>
>>
>>
>>   File 
>> "/home/developer/projects/yaw/applications/admin/controllers/default.py" 
>> , line 
>> 1352, in 
>>
>>
>>
>>
>>
>>
>>   File "/home/developer/projects/yaw/gluon/globals.py", line 173, in 
>> 
>>
>>
>>
>>
>>
>>
>> self._caller = lambda f: f()
>>
>>
>>
>>
>>
>>
>>   File 
>> "/home/developer/projects/yaw/applications/admin/controllers/default.py" 
>> , line 
>> 1085, in errors
>>
>>
>>
>>
>>
>>
>> error = pickle.load(fullpath_file)
>>
>>
>>
>>
>>
>>
>>   File "/usr/lib/python2.7/pickle.py", line 1378, in load
>>
>>
>>
>>
>>
>>
>> return Unpickler(file).load()
>>
>>
>>
>>
>>
>>
>>   File "/usr/lib/python2.7/pickle.py", line 858, in load
>>
>>
>>
>>
>>
>>
>> dispatch[key](self)
>>
>>
>>
>>
>>
>>
>>   File "/usr/lib/python2.7/pickle.py", line 880, in load_eof
>>
>>
>>
>>
>>
>>
>> raise EOFError
>>
>>
>>
>>
>>
>>
>> EOFError
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.com - Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Emails never making it to hotmail accounts

2012-04-28 Thread Bruce Wade
Hi,

Any suggestions on fixing the situation where hotmail never gets emails
from our servers using the mailer?

-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Read excel sheet in web2py

2012-04-28 Thread rahulserver
I wish to read an excel sheet in web2py.I tried few samples from python 
codes which use the xlrd object.However in web2py, when I import the xlrd 
object, I get the following error:

 No module named xlrd


So why is it like that? And is there any way to read an excel file without 
converting it to a csv file?


[web2py] Re: Read excel sheet in web2py

2012-04-28 Thread Anthony
Where is the xlrd library, and how are you importing it? Are you using the 
web2py Windows or Mac binary or running web2py from source?

Anthony

On Saturday, April 28, 2012 12:32:05 PM UTC-4, rahulserver wrote:
>
> I wish to read an excel sheet in web2py.I tried few samples from python 
> codes which use the xlrd object.However in web2py, when I import the xlrd 
> object, I get the following error:
>
>  No module named xlrd
>
>
> So why is it like that? And is there any way to read an excel file without 
> converting it to a csv file?
>


Re: [web2py] Read excel sheet in web2py

2012-04-28 Thread Gary Herron

On 04/28/2012 09:32 AM, rahulserver wrote:
I wish to read an excel sheet in web2py.I tried few samples from 
python codes which use the xlrd object.However in web2py, when I 
import the xlrd object, I get the following error:




 No module named xlrd


So why is it like that? And is there any way to read an excel file 
without converting it to a csv file?




That just means you didn't install or import the module correctly.  Both 
are easy.


Place the xlrd folder hierarchy in the modules folder of your app.

Then import it with:
xlrd = local_import('xlrd')

Then use with something like
wb = xlrd.open_workbook('some-file-name')


--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



[web2py] Re: Reloading modules

2012-04-28 Thread Yarin
Awesome- thanks!

On Saturday, April 28, 2012 10:24:21 AM UTC-4, simon wrote:
>
> from gluon.custom_import import track_changes; track_changes(True)
>
> On Saturday, 28 April 2012 14:43:42 UTC+1, Yarin wrote:
>>
>> For dev purposes, it would be nice to be able to reload modules without 
>> having to restart the server- or to have a setting that automatically 
>> reloads on each request- Otherwise it's almost impossible to do active 
>> module development from within web2py.
>
>

[web2py] Re: Reloading modules

2012-04-28 Thread Yarin
Anthony- is this a performance hit, or can it be left on?

On Saturday, April 28, 2012 10:39:00 AM UTC-4, Anthony wrote:
>
> On Saturday, April 28, 2012 10:24:21 AM UTC-4, simon wrote:
>>
>> from gluon.custom_import import track_changes; track_changes(True)
>
>
>  And note that only reloads when the module changes, not on every request.
>
> Anthony 
>


Re: [web2py] Re: Cookbook recipe for nginx/uwsgi woes

2012-04-28 Thread Pedro Vasconcelos
If you installed uWSGI from debian/ubuntu packages you need to load the 
python plugin, as RIF mentioned.

The uwsgi Quickstart  says:

*WARNING the following tutorials are based on the official releases, if you 
are using a debian-based package (that is fully modular) you will need to 
load the http and python plugins adding --plugins http,python to your 
command line.*


Be sure you already installed uwsgi-plugin-python (apt-get 
install uwsgi-plugin-python).

Good luck,

--
Pedro Vasconcelos

On Friday, April 27, 2012 11:06:26 AM UTC-3, Bruce Wade wrote:
>
> I have used this process to set up 3 servers now with uwsgi + nginx = 
> http://library.linode.com/web-servers/nginx/python-uwsgi/ubuntu-10.10-maverick
>  
>
> On Fri, Apr 27, 2012 at 1:16 AM, rif  wrote:
>
>> I had the same issue and I solved by adding plugin python in the uwsgi 
>> web2py configuration:
>>
>> 
>> python   
>>   <--HERE
>> 127.0.0.1:9001
>> /home/www-data/web2py/
>> 
>> wsgihandler
>> 
>> 
>>
>> joi, 12 aprilie 2012, 09:23:39 UTC+3, Bruce Wade a scris:
>>>
>>> I am having the exact same problem with uwsgi
>>>
>>> 2012/04/12 06:16:49 [error] 9428#0: *1 upstream prematurely closed 
>>> connection while reading response header from upstream, client: 
>>> 108.172.101.4, server: 50.18.67.206, request: "GET / HTTP/1.1", upstream: 
>>> "uwsgi://127.0.0.1:9001", host: "50.18.67.206"
>>>
>>> I tested and I can get to my static files using nginx without a problem 
>>> so I know that isn't the issue.
>>>
>>> Thinking maybe sticking with apache is a better more stable solution?
>>>
>>> On Wed, Apr 11, 2012 at 2:05 PM, Michele Comitini 
>>> <*
>>> *> wrote:
>>>
  To handle static request using "alias" instead of "root" with regexp
 should work better


  set $web2pyroot 


location ~ ^/(.*)/static/(.*) {
 alias $web2pyroot/applications/$1/**static/$2;
}

 mic


 Il 11 aprile 2012 18:23, pbreit <* **> ha 
 scritto:

 > Looks like it is having trouble with a file in /static. This is how I 
 serve
 > /static:
 >
 > location /static {
 > root /opt/web2py/applications/**myapp/;
 > }
 >
 > You may just need to add the appname to:
 > root  /home/www-data/web2py/**applications/
 >
 > Also, I don't know if you need that extra stuff on the location line.

>>>
>>>
>>>
>>> -- 
>>> -- 
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/**brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.**com  - 
>>> Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>  
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>  

[web2py] Re: Emails never making it to hotmail accounts

2012-04-28 Thread villas
Hi Bruce,

Going to 'spam' is one thing but if it never even gets delivered by Hotmail 
then I guess your server is blocked.  It is often difficult to get to the 
bottom of this,  so I suggest the following:
(1) 'Clean up' the content,  so it doesn't score high on the spam filters,
(2) Use a trusted SMTP relay service.  There will be some limits involved, 
 so if this is one of your BIGINT-required sites,  this may work out an 
expensive option.  I personally think it is worth paying something for a 
trusted relay though because with my own tests it I believe it 
significantly affected the successful-delivery rate.

Best regards,
David



On Saturday, 28 April 2012 17:04:51 UTC+1, Bruce Wade wrote:
>
> Hi,
>
> Any suggestions on fixing the situation where hotmail never gets emails 
> from our servers using the mailer?
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

[web2py] Re: Emails never making it to hotmail accounts

2012-04-28 Thread Alan Etkin
Consider using .send() with raw=True in case the receiver account is 
performing some payload filter.

On Saturday, April 28, 2012 1:04:51 PM UTC-3, Bruce Wade wrote:
>
> Hi,
>
> Any suggestions on fixing the situation where hotmail never gets emails 
> from our servers using the mailer?
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

[web2py] Re: Reloading modules

2012-04-28 Thread Yarin
I've been trying this and it is *not* working.

I put this exact line:
from gluon.custom_import import track_changes; track_changes(True)

in my 0.py model file, before any other code. But still any changes I make 
in my modules do not take effect until I restart server- or if they do it 
is inconsistently- certainly not on every new page request. Basically, no 
different than before. 




On Saturday, April 28, 2012 10:24:21 AM UTC-4, simon wrote:
>
> from gluon.custom_import import track_changes; track_changes(True)
>
> On Saturday, 28 April 2012 14:43:42 UTC+1, Yarin wrote:
>>
>> For dev purposes, it would be nice to be able to reload modules without 
>> having to restart the server- or to have a setting that automatically 
>> reloads on each request- Otherwise it's almost impossible to do active 
>> module development from within web2py.
>
>

[web2py] Re: Reloading modules

2012-04-28 Thread Anthony
On Saturday, April 28, 2012 1:50:25 PM UTC-4, Yarin wrote:
>
> Anthony- is this a performance hit, or can it be left on?
>

It has to check the modification time of each file upon import, so may be a 
small performance hit.

Anthony


[web2py] Re: File generation using web2py

2012-04-28 Thread Alan Etkin
Hi

The book example:
http://web2py.com/books/default/chapter/29/10#CSV

You might want to check the recipes site for other ideas.
http://www.web2pyslices.com/home

Making a "csv output" search at this group's search feature could be 
helpful too.

On Saturday, April 28, 2012 7:20:15 AM UTC-3, rahulserver wrote:
>
> I wish to generate a few reports in csv or txt or other file formats based 
> on some database data maintained through a crud application. Previously, it 
> was done through an asp.net application with vb as scripting language.But 
> as I explored the wonderful capabilities of web2py, I have become a fan of 
> this terrific framework.
> Is it possible to do it in web2py. And if it is, then how and where should 
> the code be placed.In the view or model or controller?
>


[web2py] Re: Reloading modules

2012-04-28 Thread Anthony
Hmm, it's working for me. Can you post a module and some code for which 
it's not working?

Anthony

On Saturday, April 28, 2012 2:40:35 PM UTC-4, Yarin wrote:
>
> I've been trying this and it is *not* working.
>
> I put this exact line:
> from gluon.custom_import import track_changes; track_changes(True)
>
> in my 0.py model file, before any other code. But still any changes I make 
> in my modules do not take effect until I restart server- or if they do it 
> is inconsistently- certainly not on every new page request. Basically, no 
> different than before. 
>

 


Re: [web2py] Read excel sheet in web2py

2012-04-28 Thread Anthony

>
> That just means you didn't install or import the module correctly.  Both 
> are easy.
>
> Place the xlrd folder hierarchy in the modules folder of your app.
>
> Then import it with:
> xlrd = local_import('xlrd')
>

Note, local_import has been deprecated. Even for modules in the 
application's /modules folder, you can now simply do:

import xlrd

Anthony 


[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-28 Thread Yarin
@Gour- The whole point of SO is you can usually find what you're looking 
for, and if not- your question will be quickly answered and easily found by 
the next person. That, and the ability to close redundant questions means 
you build a quality knowledgebase- something that doesn't happen with 
irc/twitter/google groups. 

Other benefits of SO:

   - Ability to distinguish between questions, answers, and comments
   - Ability to *edit* questions and answers
   - Ability to SORT BY VOTES
   - Ability to save and reference favorites
   - Ability to search for your issue without wanting to dropkick the screen

Google groups is missing the big things and fails on the little things that 
make SO so effective. 




[web2py] Re: Reloading modules

2012-04-28 Thread Yarin
@Anthony- There's really nothing specific to post, its a general thing, and 
not the first time i've dealt with it- just that this code fix doesn't 
change anything. Moreover, now I'm experiencing some truly odd behavior.

   1. I have a module that was throwing an error, and fixing it doesn't 
   seem to update.
   2. I quit python, restart web2py
   3. The page loads fine, module working.
   4. I make a change- ANY change, including change in comments- and i 
   start getting error tickets again, as if the old broken version of the 
   module is still cached somewhere- how this would persist after quiting and 
   restarting web2py makes no sense to me. It's just too erratic to track down.

I'm working locally with the rocket server on a Mac, if that means anything 
to anybody. 

On Saturday, April 28, 2012 9:43:42 AM UTC-4, Yarin wrote:
>
> For dev purposes, it would be nice to be able to reload modules without 
> having to restart the server- or to have a setting that automatically 
> reloads on each request- Otherwise it's almost impossible to do active 
> module development from within web2py.



Re: [web2py] Re: Reloading modules

2012-04-28 Thread Bruno Rocha
I have a similar problem.

example:

if I change this modules under this package:
https://github.com/rochacbruno/Movuca/tree/master/modules/datamodel they
never reloads, so I need to restart the server.

But if I change something in modules under this:
https://github.com/rochacbruno/Movuca/tree/master/modules/handlers It works
ok, and I dont need to restart for reload.

My track changes is in:
https://github.com/rochacbruno/Movuca/blob/master/models/0.py

On Sat, Apr 28, 2012 at 4:42 PM, Yarin  wrote:

> @Anthony- There's really nothing specific to post, its a general thing,
> and not the first time i've dealt with it- just that this code fix doesn't
> change anything. Moreover, now I'm experiencing some truly odd behavior.
>
>1. I have a module that was throwing an error, and fixing it doesn't
>seem to update.
>2. I quit python, restart web2py
>3. The page loads fine, module working.
>4. I make a change- ANY change, including change in comments- and i
>start getting error tickets again, as if the old broken version of the
>module is still cached somewhere- how this would persist after quiting and
>restarting web2py makes no sense to me. It's just too erratic to track 
> down.
>
> I'm working locally with the rocket server on a Mac, if that means
> anything to anybody.
>
> On Saturday, April 28, 2012 9:43:42 AM UTC-4, Yarin wrote:
>>
>> For dev purposes, it would be nice to be able to reload modules without
>> having to restart the server- or to have a setting that automatically
>> reloads on each request- Otherwise it's almost impossible to do active
>> module development from within web2py.
>
>


-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] autodelete image computed field

2012-04-28 Thread CtrlSoft

hi i have a resize function wich creates image thumbanils...
def THUMB(image, nx=120, ny=120):
from PIL import Image 
import os  
try:
img = Image.open(request.folder + 'static/img_folder/' + image)
img.thumbnail((nx,ny), Image.ANTIALIAS) 
root,ext = os.path.splitext(image)
thumb='%s_thumb%s' %(root, ext)
img.save(request.folder + 'static/img_folder/' + thumb)
return thumb
except: 
return None  
 
and this :
db.define_table("news",
Field('image', 'upload', requires=IS_EMPTY_OR(IS_IMAGE()), 
uploadfolder=request.folder+'static/img_folder', autodelete=True), 
Field('image_thumb', 'upload', compute=lambda r: THUMB(r['image']), 
autodelete=True), 
Field("title",label=T('Title'),requires=IS_NOT_EMPTY()),
Field("content" 
,type='text',label=T('Content'),requires=IS_NOT_EMPTY()))

the problem is when i delete a row, image("big image") is deleteing from 
disk but the image_thumb stil remains on disk. 
any solutions are welcome :), thx

___
Alex



Re: [web2py] Read excel sheet in web2py

2012-04-28 Thread RAHUL PRIYADARSI
Dear All,
Thank you very much for your reply. I was getting this error because as
Anthony pointed out "That just means you didn't install or import the
module correctly. ".So I downloaded xlrd from this link:
http://pypi.python.org/packages/source/x/xlrd/xlrd-0.7.7.tar.gz#md5=ba46c586b4c1df977bf7bdcd711590bf,extracted
it in my application's modules folder and I imported it (without
local import). Whoosh it worked!!
Thank you very much.
Reply me for party anytime

On 29 April 2012 00:27, Anthony  wrote:

> That just means you didn't install or import the module correctly.  Both
>> are easy.
>>
>> Place the xlrd folder hierarchy in the modules folder of your app.
>>
>> Then import it with:
>> xlrd = local_import('xlrd')
>>
>
> Note, local_import has been deprecated. Even for modules in the
> application's /modules folder, you can now simply do:
>
> import xlrd
>
> Anthony
>


Re: [web2py] autodelete image computed field

2012-04-28 Thread Bruno Rocha
try setting uploadfolder=request.folder+'static/img_folder' to the
thumbnail field.

I guess web2py will look this to unlink the file.

On Sat, Apr 28, 2012 at 9:06 PM, CtrlSoft  wrote:

> uploadfolder=request.folder+'static/img_folder'
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: SQLFORM.factory Field2 depends on Field1

2012-04-28 Thread cory n
Yeah, I thought it would have to be a little complicated, I was hoping 
there was an easy way out.

Any how, I got it working and will post it as a slice next week.  Thank you 
gentlemen.

Cory

On Friday, April 27, 2012 1:44:58 PM UTC-5, Anthony wrote:
>
> See 
> http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
> .
>
> On Friday, April 27, 2012 11:00:44 AM UTC-4, cory n wrote:
>>
>> This works, after I submit once, then my selection for FIELD1 appears in 
>> FIELD2.  I need it to operate before a submit though, so that once a 
>> "Segment" is selected, I can use that selection in the other dropdown boxes 
>> before a submit.
>>
>> Thanks
>>
>> Cory
>>
>> On Friday, April 27, 2012 8:13:58 AM UTC-5, Massimo Di Pierro wrote:
>>>
>>> IS_IN_SET(getFamilies(form.vars.Segment
>>>
>>> should be
>>>
>>> IS_IN_SET(getFamilies(request.vars.Segment
>>>
>>> but I would not set this validator in models, I would set it in 
>>> controller function, where needed.
>>>
>>> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:

 Okay, I want to make the second field of a SQLFORM.factory depend on 
 what is chosen in the first field...  something like this...

 form = SQLFORM.factory(
 Field('PN', requires=IS_NOT_EMPTY()),
 Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
 Field('Family', 
 requires=IS_IN_SET(getFamilies(form.vars.Segment
 ...

 Of course I can't use form.vars.Segment until the form is submitted, so 
 how can I accomplish this?

 So that the field 'Family' takes the value of the field 'Segment', does 
 a calculation and returns the appropriate list of families.

 I'm super new to web programming, so I apologize in advance if this is 
 a dumb question.





>>> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:

 Okay, I want to make the second field of a SQLFORM.factory depend on 
 what is chosen in the first field...  something like this...

 form = SQLFORM.factory(
 Field('PN', requires=IS_NOT_EMPTY()),
 Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
 Field('Family', 
 requires=IS_IN_SET(getFamilies(form.vars.Segment
 ...

 Of course I can't use form.vars.Segment until the form is submitted, so 
 how can I accomplish this?

 So that the field 'Family' takes the value of the field 'Segment', does 
 a calculation and returns the appropriate list of families.

 I'm super new to web programming, so I apologize in advance if this is 
 a dumb question.






Re: [web2py] String EOF error

2012-04-28 Thread Massimo Di Pierro
If I undestand the issue, you have a corrupted error ticket. The web2py in 
trunk should detect that and give you a graceful erro. what version do you 
have?

On Saturday, 28 April 2012 10:27:04 UTC-5, Bruce Wade wrote:
>
> No suggestions on how to fix this? Everytime I go to admin -> application 
> -> errors I get this.
>
> On Thu, Apr 26, 2012 at 8:05 AM, Bruce Wade  wrote:
>
>> Yes I use pickle for my adviewer but that works without a problem. and we 
>> can view all pages. I will look at the link you sent now
>>
>>
>> On Thu, Apr 26, 2012 at 7:54 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Maybe related : 
>>> https://groups.google.com/forum/?fromgroups#!topic/web2py/3VOr81wpP94
>>>
>>>
>>> On Thu, Apr 26, 2012 at 10:53 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Ok, but do you use pikled object in your app?

 If so, it could come from your code.

 There is maybe broken stuff in web2py, I saw mail passing on the list 
 about pickle that could not work properly in newer version or in some 
 circonstance, don't remember...

 I don't know I just try to help.

 Richard


 On Thu, Apr 26, 2012 at 10:28 AM, Bruce Wade wrote:

> Yeah except this is an issue with web2py I can't even view my apps 
> error page as I just get that message now every time.However when viewing 
> my site normally there is no problems
>
> On Thu, Apr 26, 2012 at 7:06 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> May help?!
>>
>> http://bytes.com/topic/python/answers/36704-graceful-adetection-eof
>>  
>> Richard
>>
>>
>> On Wed, Apr 25, 2012 at 5:29 PM, Bruce Wade wrote:
>>
>>> Hi I randomly get a EOFError this doesn't always happen and I have no 
>>> idea what is causing it.
>>>
>>> Traceback (most recent call last):
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   File "/home/developer/projects/yaw/gluon/restricted.py", line 205, in 
>>> restricted
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> exec ccode in environment
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   File 
>>> "/home/developer/projects/yaw/applications/admin/controllers/default.py"
>>>  , line 
>>> 1352, in 
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   File "/home/developer/projects/yaw/gluon/globals.py", line 173, in 
>>> 
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> self._caller = lambda f: f()
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   File 
>>> "/home/developer/projects/yaw/applications/admin/controllers/default.py"
>>>  , line 
>>> 1085, in errors
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> error = pickle.load(fullpath_file)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   File "/usr/lib/python2.7/pickle.py", line 1378, in load
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> return Unpickler(file).load()
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   File "/usr/lib/python2.7/pickle.py", line 858, in load
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> dispatch[key](self)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   File "/usr/lib/python2.7/pickle.py", line 880, in load_eof
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> raise EOFError
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> EOFError
>>>
>>>
>>> -- 
>>> -- 
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>  

>>>
>>
>>
>> -- 
>> -- 
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>  
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
> 

[web2py] Re: Emails never making it to hotmail accounts

2012-04-28 Thread Massimo Di Pierro
When you send it, you set a sender which is probably not the same domain as 
the sending machine. Some servers notice that and consider the email as 
spam. You should make sure the domain of the server is the same as the 
email sender address.

On Saturday, 28 April 2012 13:34:36 UTC-5, Alan Etkin wrote:
>
> Consider using .send() with raw=True in case the receiver account is 
> performing some payload filter.
>
> On Saturday, April 28, 2012 1:04:51 PM UTC-3, Bruce Wade wrote:
>>
>> Hi,
>>
>> Any suggestions on fixing the situation where hotmail never gets emails 
>> from our servers using the mailer?
>>
>> -- 
>> -- 
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>

Re: [web2py] String EOF error

2012-04-28 Thread Bruce Wade
1.99.7 is the version I am using.

On Sat, Apr 28, 2012 at 9:32 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> If I undestand the issue, you have a corrupted error ticket. The web2py in
> trunk should detect that and give you a graceful erro. what version do you
> have?
>
>
> On Saturday, 28 April 2012 10:27:04 UTC-5, Bruce Wade wrote:
>>
>> No suggestions on how to fix this? Everytime I go to admin -> application
>> -> errors I get this.
>>
>> On Thu, Apr 26, 2012 at 8:05 AM, Bruce Wade  wrote:
>>
>>> Yes I use pickle for my adviewer but that works without a problem. and
>>> we can view all pages. I will look at the link you sent now
>>>
>>>
>>> On Thu, Apr 26, 2012 at 7:54 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Maybe related : https://groups.google.com/**forum/?fromgroups#!topic/**
 web2py/3VOr81wpP94


 On Thu, Apr 26, 2012 at 10:53 AM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Ok, but do you use pikled object in your app?
>
> If so, it could come from your code.
>
> There is maybe broken stuff in web2py, I saw mail passing on the list
> about pickle that could not work properly in newer version or in some
> circonstance, don't remember...
>
> I don't know I just try to help.
>
> Richard
>
>
> On Thu, Apr 26, 2012 at 10:28 AM, Bruce Wade wrote:
>
>> Yeah except this is an issue with web2py I can't even view my apps
>> error page as I just get that message now every time.However when viewing
>> my site normally there is no problems
>>
>> On Thu, Apr 26, 2012 at 7:06 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> May help?!
>>>
>>> http://bytes.com/topic/python/**answers/36704-graceful-**
>>> adetection-eof
>>>
>>> Richard
>>>
>>>
>>> On Wed, Apr 25, 2012 at 5:29 PM, Bruce Wade wrote:
>>>
 Hi I randomly get a EOFError this doesn't always happen and I have no 
 idea what is causing it.

 Traceback (most recent call last):







   File "/home/developer/projects/yaw/**gluon/restricted.py", line 205, 
 in restricted







 exec ccode in environment







   File 
 "/home/developer/projects/yaw/**applications/admin/**controllers/default.py"
  , line 
 1352, in 







   File "/home/developer/projects/yaw/**gluon/globals.py", line 173, in 
 







 self._caller = lambda f: f()







   File 
 "/home/developer/projects/yaw/**applications/admin/**controllers/default.py"
  , line 
 1085, in errors







 error = pickle.load(fullpath_file)







   File "/usr/lib/python2.7/pickle.py"**, line 1378, in load







 return Unpickler(file).load()







   File "/usr/lib/python2.7/pickle.py"**, line 858, in load







 dispatch[key](self)







   File "/usr/lib/python2.7/pickle.py"**, line 880, in load_eof







 raise EOFError







 EOFError


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/**brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.**com - 
 Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com - 
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>

>>>
>>>
>>> --
>>> --
>>> Regards,

Re: [web2py] Re: Emails never making it to hotmail accounts

2012-04-28 Thread Bruce Wade
Domain youadworld.com sending address sys...@youadworld.com

On Sat, Apr 28, 2012 at 9:34 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> When you send it, you set a sender which is probably not the same domain
> as the sending machine. Some servers notice that and consider the email as
> spam. You should make sure the domain of the server is the same as the
> email sender address.
>
>
> On Saturday, 28 April 2012 13:34:36 UTC-5, Alan Etkin wrote:
>>
>> Consider using .send() with raw=True in case the receiver account is
>> performing some payload filter.
>>
>> On Saturday, April 28, 2012 1:04:51 PM UTC-3, Bruce Wade wrote:
>>>
>>> Hi,
>>>
>>> Any suggestions on fixing the situation where hotmail never gets emails
>>> from our servers using the mailer?
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/**brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.**com  -
>>> Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] SQLFORM

2012-04-28 Thread Vibhor Purandare
HOW TO CHANGE STYLE OF SQLFORM(eg TEXT BOX Style)
 I want to change text box style?