[web2py] Failed to import a module that named with 'plugin_' prefix in application/modules directory.

2011-10-14 Thread seongjoo
When I am working with a module located in application/modules
directory with development server with python 2.7, having the module's
name with 'plugin_' prefix works fine.

Stuff that does NOT work

import plugin_module

I deployed the module with the app to the Apache server on Windows
with python 2.7. , and it gives me ImportError. So I changed the
module's name to without 'plugin_' prefix, it started working.

Stuff that does work

import module

It gave me a feeling of crisis a bit since I was confident that it
would work as It has worked on development server. I just want to
confirm that the problem is of my naming convention, or some policy
related matter of web2py, or python's module naming violation. Thank
you.


[web2py] Some say local_import is deprecated. Is it?

2011-10-14 Thread seongjoo
While solving some problems of importing module, I found a web article
that contains some argument saying that local_import is deprecated.

http://comments.gmane.org/gmane.comp.python.web2py/67885

The web2py book (ed 3.1) has no mention about local_import being
deprecated, so I would like to know it is or it is not.



Re: [web2py] Some say local_import is deprecated. Is it?

2011-10-14 Thread Bruno Rocha
It is still supported and should work, but it is deprecated and encouraged
to use the new import system

On Fri, Oct 14, 2011 at 3:22 AM, seongjoo seongjoo@gmail.com wrote:

 While solving some problems of importing module, I found a web article
 that contains some argument saying that local_import is deprecated.

 http://comments.gmane.org/gmane.comp.python.web2py/67885

 The web2py book (ed 3.1) has no mention about local_import being
 deprecated, so I would like to know it is or it is not.




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Re: IMPORTANT

2011-10-14 Thread Gour
On Thu, 13 Oct 2011 16:33:58 -0700 (PDT)
Massimo Di Pierro
massimo.dipie...@gmail.com wrote:

Dear Massimo,

 Yes perhaps we should close this thread. I do not see it going
 anywhere.

I do not agree with your conclusion...

 I think we can all agree that: We welcome people of any gender
 identity or expression, race, ethnicity, size, nationality, sexual
 orientation, ability level, religion, culture, subculture, and
 political opinion (from
 http://mail.python.org/mailman/listinfo/diversity)

This is nice.

 We can also agree that any comment that is intentionally offending or
 discriminating other users and groups will not be tolerating. This
 never happened and I am confident it will not.

First of all you have started this thread with IMPORTANT subject and wrote
that:

Some people have expressed their believes (political,
religious, metaphysical) but occasionally when this conflicts with
believes of another person, the other person may feel offended. It has
happened.

and clarified it did not happen in the body of the message, but In
those cases when religious or political statement was made, it was
done in the form of a signature.

Further, you suggested: Perhaps having a policy that says we should make no
political/ religious/philosophical statements is the simplest policy to
implement. although majority of courageous users who openly reveled their mind
in this thread (almost) univocally said that for them there is NO issue and
suggested live and let live policy.

Moreover, it was confirmed (in majority) that people are not bothered what
someone puts in his signature until it's not against other beliefs, attacking
other groups etc. and conclusion of majority users is that so far, there was
nothing against such policy posted here, either in the content or in the
signature.

Your original statetment was, however, re-inforcing the point that there is an
issue: 

The problem with this issue is that... and I am just telling
everybody there is an issue. Some people have been raising it
privately. You may want to think twice about what you put in your
emails. You may get more people to help you if you are neutral.

suggesting that users should think about what is put in their email, iow.
signature.

So, according to my understanding, you, somehow, took the side of minority
users who complained (most of them privately) although it's in clear opposition
what the majority of users think here which means that those minority users
were actually acting contrary to the, so far, unexpressed policy and they are
the ones which should apologize!

Moreover, at least, the feelings of one user were hurt in the process (This
thread has saddened me, however.) and Johann is old web2py user (Gmane here
finds his first post at Sun, 14 Jun 2009), so, based on everything above, I
cannot conclude how this thread ...I do not see it going anywhere.?

Just the opposite...users expressed their view that the policy should be live
and let live and that, so far, it was not broken by anybody either by posting
'forbidden' content in the body of the message nor in the form of someone's
signature. Iow, your 'bug report' should be marked as 'invalid'. ;)

I very much  appreciate everything what you do for web2py project, but I must
say that I have expected some more maturity in handling this whole issue which
hurts some people.

Hoping that you will take my post as constructive criticism and not more.


Sincerely,
Gour


-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


Re: [web2py] Re: confused with install on centos 5.7

2011-10-14 Thread Kenneth Lundström

Hi Lucas,

if's possible try Centos 6.

I just tried. Installed Apache with 'yum groupinstall Web Server', 
disabled selinux (or configure it), unzipped web2py.zip src file, 
configured Apache and 'apachectl start'.


Voila it works.


Kenneth


CentOS 5 uses an old ver of python I believe but I stopped after 5.6.
The only way I got it to work was under virtualenv and that was after
compiling separate version of python (best not to dump the old version
as yum depends on python 2.4).  As Peter states it will require great
manual labor on your part to get it up and running.

CentOS 6 has python 2.6.5 or something.  web2py is cake on 6.x.  Or if
you're in a bind, virtualenv.

Regards,
David

On Oct 12, 6:56 am, lucassjluk...@gmail.com  wrote:

hello one and all,

i have tried to run the web2py install script on a centos 5.7 server.
it seems to install ok with the addition of adding python 2.6 from
source and compiling it as well.  after the install script runs,
apache doesn't restart properly giving the warning NameVirtualHost *:
80 has no VirtualHosts which leads to an 500 Internal Server Error
if you access the http interface.

after reading a bunch of posts under this group for an install on
centos 5, i am wondering, has anyone gotten web2py to successfully
work under centos 5.7 or centos 5 and if so, please direct me to the
thread or solution?

thank you in advance and have a great day.  lucas




Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Michele Comitini
Webdriver/Chromedriver is another alternative.

http://www.chromium.org/developers/testing/webdriver-for-chrome

mic
Il giorno 14/ott/2011 01:53, Massimo Di Pierro massimo.dipie...@gmail.com
ha scritto:

 I have used mechanize and I was pretty impressed.
 http://wwwsearch.sourceforge.net/mechanize/

 On Oct 13, 10:39 am, Bruno Rocha rochacbr...@gmail.com wrote:
  a fun way is using splinter to emulate a browser action.
 
  http://splinter.cobrateam.info/
 
  http://zerp.ly/rochacbruno
  Em 13/10/2011 07:23, Johann Spies johann.sp...@gmail.com escreveu:
 
 
 
 
 
 
 
   I want to upload 388 documents and I don't want to do that by typing
 the
   name of the document and clicking on the correct file:)
 
   Using scripting I can provide the path to the file.  How do I tell
 Web2py
   in a script to upload that file?
 
   Regards
   Johann
 
   --
May grace and peace be yours in abundance through the full knowledge
 of
   God and of Jesus our Lord!  His divine power has given us everything we
 need
   for life and godliness through the full knowledge of the one who called
 us
   by his own glory and excellence.
   2 Pet. 1:2b,3a


Re: [web2py] Re: confused with install on centos 5.7

2011-10-14 Thread Kenneth Lundström
If you need the Apache configuration file send me an email and I'll mail 
it to you.



Kenneth


Hi Lucas,

if's possible try Centos 6.

I just tried. Installed Apache with 'yum groupinstall Web Server', 
disabled selinux (or configure it), unzipped web2py.zip src file, 
configured Apache and 'apachectl start'.


Voila it works.


Kenneth


CentOS 5 uses an old ver of python I believe but I stopped after 5.6.
The only way I got it to work was under virtualenv and that was after
compiling separate version of python (best not to dump the old version
as yum depends on python 2.4).  As Peter states it will require great
manual labor on your part to get it up and running.

CentOS 6 has python 2.6.5 or something.  web2py is cake on 6.x.  Or if
you're in a bind, virtualenv.

Regards,
David

On Oct 12, 6:56 am, lucassjluk...@gmail.com  wrote:

hello one and all,

i have tried to run the web2py install script on a centos 5.7 server.
it seems to install ok with the addition of adding python 2.6 from
source and compiling it as well.  after the install script runs,
apache doesn't restart properly giving the warning NameVirtualHost *:
80 has no VirtualHosts which leads to an 500 Internal Server Error
if you access the http interface.

after reading a bunch of posts under this group for an install on
centos 5, i am wondering, has anyone gotten web2py to successfully
work under centos 5.7 or centos 5 and if so, please direct me to the
thread or solution?

thank you in advance and have a great day.  lucas






[web2py] Represent, list:reference, upload-field

2011-10-14 Thread Johann Spies
This table

db.define_table(wbdocuments,
Field(name, label = Document name),
Field(file, upload, label = Download),
format = '%(name)s')

is linked in another table:

db.define_table('wbmaster',
   Field('documents', 'list:reference wbdocuments'))

As long as I do not add a .represent to the second table's 'documents' I can
see the names of the documents in smartgrid as a
comma seperated list.

I want those doccuments to be downloadable when clicked on.

I see in the book

db.mytable.some_uploadfield.represent = lambda value,row: \
A http://web2py.com/book/default/docstring/A('get it', _href=URL
http://web2py.com/book/default/docstring/URL('download',
args=value))


can be used but so far I did not have any  success.

As soon as I try


db.wbmaster.documents.represent = lambda value, row: \
A('%s' % row.name, _href = URL('download', args = value))

I just get a concatenation of the id's  (eg. 69) where without it I would
see a string like: 'x.docx, y.pdf'

Help would be appreciated.

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


[web2py] SOLVED: compute field and reference

2011-10-14 Thread andrej burja
there are two ways: 

db.define_table('quantity',
   Field('value','integer'))

db.define_table('item',
Field('unit_price','double'),
Field('quantity',db.quantity),
Field('total_price',
compute=lambda r: 
r['unit_price']*db.quantity[r.quantity].value))
or
   compute=lambda r: r['unit_price'] 
*db.quantity(r['quantity']).value








[web2py] Re: Better off-line book?

2011-10-14 Thread Massimo Di Pierro
+1

On Oct 14, 12:44 am, ma...@rockiger.com rocki...@googlemail.com
wrote:
 Hi Samuele,

 use wget:

 wget --recursive -l 1 --no-clobber --page-requisites --html-extension
 --convert-links --restrict-file-names=windows --domains web2py.com
 --no-parenthttp://www.web2py.com/book

 This way you get the whole book properly link. Everything ist in there.


[web2py] Re: Failed to import a module that named with 'plugin_' prefix in application/modules directory.

2011-10-14 Thread Massimo Di Pierro
When it does not work can you zip and and send a small example?
perhaps open a ticket?

On Oct 14, 1:15 am, seongjoo seongjoo@gmail.com wrote:
 When I am working with a module located in application/modules
 directory with development server with python 2.7, having the module's
 name with 'plugin_' prefix works fine.

 Stuff that does NOT work

 import plugin_module

 I deployed the module with the app to the Apache server on Windows
 with python 2.7. , and it gives me ImportError. So I changed the
 module's name to without 'plugin_' prefix, it started working.

 Stuff that does work

 import module

 It gave me a feeling of crisis a bit since I was confident that it
 would work as It has worked on development server. I just want to
 confirm that the problem is of my naming convention, or some policy
 related matter of web2py, or python's module naming violation. Thank
 you.


[web2py] Re: IMPORTANT

2011-10-14 Thread Massimo Di Pierro
First of all I apologize. The expression this thread is not going
anywhere was not appropriate. User input was valuable.  What I meant
to say it that there was no consensus on a policy in this regard other
than stated, therefore statistically, I did not expect more comments
to change that.

One correction. I have not taken any side on the issue. I have just
reported a possible problem that some users have reported to me.

Another correction. I did not close this thread. I suggested that
perhaps we should close it because it is better if this discussion
stops and we leave things as they are. Hopefully this thread has
contributed to more awareness on the issue but the issue itself is not
a subject of this mailing list.

I do not think anybody should be saddened this this thread. people
think differently, believe in different things and sometimes they
disagree. That is a fact of life. The good thing is that even if there
may be beliefs that divide us we can still find us something that
unites us and gets us to talk to each other. This list is a place
where people from different countries and different backgrounds don't
just talk to each other but talk with respect and treat others as
pears. I think this is something to be happy about.

Massimo

On Oct 14, 1:44 am, Gour g...@atmarama.net wrote:
 On Thu, 13 Oct 2011 16:33:58 -0700 (PDT)
 Massimo Di Pierro

 massimo.dipie...@gmail.com wrote:

 Dear Massimo,

  Yes perhaps we should close this thread. I do not see it going
  anywhere.

 I do not agree with your conclusion...

  I think we can all agree that: We welcome people of any gender
  identity or expression, race, ethnicity, size, nationality, sexual
  orientation, ability level, religion, culture, subculture, and
  political opinion (from
 http://mail.python.org/mailman/listinfo/diversity)

 This is nice.

  We can also agree that any comment that is intentionally offending or
  discriminating other users and groups will not be tolerating. This
  never happened and I am confident it will not.

 First of all you have started this thread with IMPORTANT subject and wrote
 that:

 Some people have expressed their believes (political,
 religious, metaphysical) but occasionally when this conflicts with
 believes of another person, the other person may feel offended. It has
 happened.

 and clarified it did not happen in the body of the message, but In
 those cases when religious or political statement was made, it was
 done in the form of a signature.

 Further, you suggested: Perhaps having a policy that says we should make no
 political/ religious/philosophical statements is the simplest policy to
 implement. although majority of courageous users who openly reveled their 
 mind
 in this thread (almost) univocally said that for them there is NO issue and
 suggested live and let live policy.

 Moreover, it was confirmed (in majority) that people are not bothered what
 someone puts in his signature until it's not against other beliefs, attacking
 other groups etc. and conclusion of majority users is that so far, there was
 nothing against such policy posted here, either in the content or in the
 signature.

 Your original statetment was, however, re-inforcing the point that there is an
 issue:

 The problem with this issue is that... and I am just telling
 everybody there is an issue. Some people have been raising it
 privately. You may want to think twice about what you put in your
 emails. You may get more people to help you if you are neutral.

 suggesting that users should think about what is put in their email, iow.
 signature.

 So, according to my understanding, you, somehow, took the side of minority
 users who complained (most of them privately) although it's in clear 
 opposition
 what the majority of users think here which means that those minority users
 were actually acting contrary to the, so far, unexpressed policy and they are
 the ones which should apologize!

 Moreover, at least, the feelings of one user were hurt in the process (This
 thread has saddened me, however.) and Johann is old web2py user (Gmane here
 finds his first post at Sun, 14 Jun 2009), so, based on everything above, I
 cannot conclude how this thread ...I do not see it going anywhere.?

 Just the opposite...users expressed their view that the policy should be live
 and let live and that, so far, it was not broken by anybody either by posting
 'forbidden' content in the body of the message nor in the form of someone's
 signature. Iow, your 'bug report' should be marked as 'invalid'. ;)

 I very much  appreciate everything what you do for web2py project, but I must
 say that I have expected some more maturity in handling this whole issue which
 hurts some people.

 Hoping that you will take my post as constructive criticism and not more.

 Sincerely,
 Gour

 --
 “In the material world, conceptions of good and bad are
 all mental speculations…” (Sri Caitanya Mahaprabhu)

 http://atmarama.net| Hlapicina (Croatia) | GPG: 52B5C810


[web2py] Re: Represent, list:reference, upload-field

2011-10-14 Thread Massimo Di Pierro
documents is a list of IDs so you have to turn each one of them into a
link. You can try:

db.wbmaster.documents.represent = lambda value, row: SPAN(*[row.name]+
[A(v, _href = URL('download', args = v)) for v in value])

Hope I make sense.

On Oct 14, 3:29 am, Johann Spies johann.sp...@gmail.com wrote:
 This table

 db.define_table(wbdocuments,
                 Field(name, label = Document name),
                 Field(file, upload, label = Download),
                 format = '%(name)s')

 is linked in another table:

 db.define_table('wbmaster',
                            Field('documents', 'list:reference wbdocuments'))

 As long as I do not add a .represent to the second table's 'documents' I can
 see the names of the documents in smartgrid as a
 comma seperated list.

 I want those doccuments to be downloadable when clicked on.

 I see in the book

 db.mytable.some_uploadfield.represent = lambda value,row: \
     A http://web2py.com/book/default/docstring/A('get it', _href=URL
 http://web2py.com/book/default/docstring/URL('download',
 args=value))

 can be used but so far I did not have any  success.

 As soon as I try

 db.wbmaster.documents.represent = lambda value, row: \
         A('%s' % row.name, _href = URL('download', args = value))

 I just get a concatenation of the id's  (eg. 69) where without it I would
 see a string like: 'x.docx, y.pdf'

 Help would be appreciated.

 Regards
 Johann
 --
  May grace and peace be yours in abundance through the full knowledge of God
 and of Jesus our Lord!  His divine power has given us everything we need for
 life and godliness through the full knowledge of the one who called us by
 his own glory and excellence.
                                                     2 Pet. 1:2b,3a


[web2py] Re: IMPORTANT

2011-10-14 Thread Gour
On Fri, 14 Oct 2011 02:09:14 -0700 (PDT)
Massimo Di Pierro
massimo.dipie...@gmail.com wrote:

 First of all I apologize. The expression this thread is not going
 anywhere was not appropriate. User input was valuable.  

/me nods

 What I meant to say it that there was no consensus on a policy in this regard
 other than stated, therefore statistically, I did not expect more comments to
 change that.

Well, majority of people it seems to agree with live and let live policy,
don't they do?

 One correction. I have not taken any side on the issue. I have just
 reported a possible problem that some users have reported to me.

It looks that 'some users' are in minority to those who spoke up that for them
there is no issue really 'since they were not bothered by any content posted
here.

So, my complain is that you took the voice of 'some users' and, based
on that. declared there is an issue, although majority thinks
differently considering their input in the thread.

 Another correction. I did not close this thread. I suggested that
 perhaps we should close it because it is better if this discussion
 stops and we leave things as they are. Hopefully this thread has
 contributed to more awareness on the issue but the issue itself is not
 a subject of this mailing list.

I agree with that, but did not agree that this thread is not going
anywhere - users input has coloured different picture.

 I do not think anybody should be saddened this this thread. 

It is your thinking only - Johann expressed clearly his feelings.

So, in the same manner as you were sensitive to those who privately expressed
their opinion, it would be nice to honour Johann's expression as well. At
least, he has courage to speak in the public and I very much admire his humble
statement. There is lot to be learnt from him.

 people think differently, believe in different things and sometimes they
 disagree. That is a fact of life. 

Sure.

 The good thing is that even if there may be beliefs that divide us we can
 still find us something that unites us and gets us to talk to each other. 

I hope so.

 This list is a place where people from different countries and different
 backgrounds don't just talk to each other but talk with respect and treat
 others as pears. I think this is something to be happy about.

Well comments like it may be disturbing to read a signature quoting a
political statement or verse from a religious book. are not in that league and
I'm not aware nor interested about those 'private comments'.


Sincerely,
Gour


-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Johann Spies
On 14 October 2011 01:53, Massimo Di Pierro massimo.dipie...@gmail.comwrote:

 I have used mechanize and I was pretty impressed.
 http://wwwsearch.sourceforge.net/mechanize/


Thanks.  I have spent about 2 hours to get working with mechanize and
Splinter but I am getting nowhere.  The documentation gave a few examples
but as soon as I want something not covered by the examples, there were not
enough documentation to help me.

With mechanize I am stumped by the fact that I cannot find the name of the
crud form on the page - even if I use the 'form_name' parameter when
creating the form.

With Splinter I got a bit further: I could fill the 'file' field of the
form  but not the 'name' field because I could not figure out how to specify
that element in the script.

I will probably doing it faster by hand.

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Bruno Rocha
http://zerp.ly/rochacbruno
Em 14/10/2011 07:02, Johann Spies johann.sp...@gmail.com escreveu:

 On 14 October 2011 01:53, Massimo Di Pierro massimo.dipie...@gmail.comwrote:

 I have used mechanize and I was pretty impressed.
 http://wwwsearch.sourceforge.net/mechanize/


 Thanks.  I have spent about 2 hours to get working with mechanize and
 Splinter but I am getting nowhere.  The documentation gave a few examples
 but as soon as I want something not covered by the examples, there were not
 enough documentation to help me.

 With mechanize I am stumped by the fact that I cannot find the name of the
 crud form on the page - even if I use the 'form_name' parameter when
 creating the form.

 With Splinter I got a bit further: I could fill the 'file' field of the
 form  but not the 'name' field because I could not figure out how to specify
 that element in the script.

 I will probably doing it faster by hand.

 Regards
 Johann
 --
  May grace and peace be yours in abundance through the full knowledge of
 God and of Jesus our Lord!  His divine power has given us everything we need
 for life and godliness through the full knowledge of the one who called us
 by his own glory and excellence.
 2 Pet. 1:2b,3a




Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Bruno Rocha
do you have firebug? splinter use same selectors of css (pure DOM)

the id of field is something like 'tablename_fieldname'

http://zerp.ly/rochacbruno
Em 14/10/2011 07:02, Johann Spies johann.sp...@gmail.com escreveu:

 On 14 October 2011 01:53, Massimo Di Pierro massimo.dipie...@gmail.comwrote:

 I have used mechanize and I was pretty impressed.
 http://wwwsearch.sourceforge.net/mechanize/


 Thanks.  I have spent about 2 hours to get working with mechanize and
 Splinter but I am getting nowhere.  The documentation gave a few examples
 but as soon as I want something not covered by the examples, there were not
 enough documentation to help me.

 With mechanize I am stumped by the fact that I cannot find the name of the
 crud form on the page - even if I use the 'form_name' parameter when
 creating the form.

 With Splinter I got a bit further: I could fill the 'file' field of the
 form  but not the 'name' field because I could not figure out how to specify
 that element in the script.

 I will probably doing it faster by hand.

 Regards
 Johann
 --
  May grace and peace be yours in abundance through the full knowledge of
 God and of Jesus our Lord!  His divine power has given us everything we need
 for life and godliness through the full knowledge of the one who called us
 by his own glory and excellence.
 2 Pet. 1:2b,3a




Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Bruno Rocha
note: you can do that on the server side. just need to put all the files
directly under upload folder and loop throught them. So the store method can
be used to create the record.

http://zerp.ly/rochacbruno
Em 14/10/2011 07:18, Bruno Rocha rochacbr...@gmail.com escreveu:

 do you have firebug? splinter use same selectors of css (pure DOM)

 the id of field is something like 'tablename_fieldname'

 http://zerp.ly/rochacbruno
 Em 14/10/2011 07:02, Johann Spies johann.sp...@gmail.com escreveu:

 On 14 October 2011 01:53, Massimo Di Pierro 
 massimo.dipie...@gmail.comwrote:

 I have used mechanize and I was pretty impressed.
 http://wwwsearch.sourceforge.net/mechanize/


 Thanks.  I have spent about 2 hours to get working with mechanize and
 Splinter but I am getting nowhere.  The documentation gave a few examples
 but as soon as I want something not covered by the examples, there were not
 enough documentation to help me.

 With mechanize I am stumped by the fact that I cannot find the name of the
 crud form on the page - even if I use the 'form_name' parameter when
 creating the form.

 With Splinter I got a bit further: I could fill the 'file' field of the
 form  but not the 'name' field because I could not figure out how to specify
 that element in the script.

 I will probably doing it faster by hand.

 Regards
 Johann
 --
  May grace and peace be yours in abundance through the full knowledge of
 God and of Jesus our Lord!  His divine power has given us everything we need
 for life and godliness through the full knowledge of the one who called us
 by his own glory and excellence.
 2 Pet. 1:2b,3a




Re: [web2py] Re: Represent, list:reference, upload-field

2011-10-14 Thread Johann Spies
On 14 October 2011 11:14, Massimo Di Pierro massimo.dipie...@gmail.comwrote:

 documents is a list of IDs so you have to turn each one of them into a
 link. You can try:

 db.wbmaster.documents.represent = lambda value, row: SPAN(*[row.name]+
 [A(v, _href = URL('download', args = v)) for v in value])

 Hope I make sense.

 Yes, it does, thank you.

But that also did not do the job.  I still got a '69' in stead of a list of
names.  I have changed that to

db.wbmaster.documents.represent = lambda value, row:
[A(db.wbdocuments[v].name + ', ', _href = URL('download', args = v)) for v
in value]

(I am not sure how to use 'SPAN' in this case - or why) and now I get a list
of links which is what I was looking for.
But the links are wrong.  When clicked on the first link the URL was
http://localhost:8000/init/wbank/download/6
where it should have downloaded the record with id=6 from db.wbdocuments.

Now I just get a 404 NOT FOUND.

Regards
Johann


[web2py] Re: Back to home page every time i click cancle button

2011-10-14 Thread Anthony
Maybe try onclick=parent.location='{{=URL('default', 'index')}}'

On Friday, October 14, 2011 1:01:54 AM UTC-4, Saurabh S wrote:

 tr class=submitrow 
 td{{=form.custom.submit}}/td 
 tdinput style=margin-left:0px id=cancel 
 class=submit type=reset onclick=window.history.back() 
 value=Cancel/td 



 i want to replace on-click function with something that always 
 redirects me to my home pagesuppose my home page is 
 http://127.0.0.1:8000...how 
 it would be possible 

 please suggest...



[web2py] Re: IMPORTANT

2011-10-14 Thread Paul Gerrard
My 2p worth.

I run a couple of communities relating to software testing. One is
public (uktmf.com) one is private (testers-retreat.org) and this kind
of discussion arises from time to time, often about face to face
communications. People who are passionate DO get upset - it happens.
Testers are a particularly pedantic lot and see their mission in life
to be critical. So testers are 'ten times worse'.

This forum is about web2py for users of it and developers of it.

There's a famous poem by W.B. Yeats http://elise.com/quotes/quotes/yeats.htm
... tread softly because you tread on my dreams.

If you share your dreams here - people will tread on them if they
don't share them. Period. So if you have a passion that isn't web2py
or python or related - watch out - you may offend and be offended.

For example. This is just an EXAMPLE. No offence Gour, but I don't
think your quote stacks up. Let me critique it very quickly. All
concepts are mental contrivances. So conceptions of anything are
mental speculations. In ANY world. So the quote says nothing and its
just plain wrong anyway. Have we enriched humanity by sharing the
quote or critiquing it? Of course not. It's just noise.

Now everyone could critique everyone elses quasi-religious, -mystic or
-philosophic statements made in the forum. But it really won't get us
anywhere.

It's just noise and detracts from the purpose of the group. So put
your non-web2py musings somewhere else. It's not because you may
offend it's because criticism may offend you and there are plenty
other forums for that kind of thing. So the policy should be - bring
germane content in here or expect to be criticised - politely at all
times of course.


Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Johann Spies
On 14 October 2011 12:18, Bruno Rocha rochacbr...@gmail.com wrote:

 do you have firebug? splinter use same selectors of css (pure DOM)


Yes, I am using Firebug. I have tried again now and still have not got to a
working solution.

The form looks like this (screenshot attached if from the browser opened by
Splinter):

table
tbody
tr id=wbdocuments_name__row
td class=w2p_fl
label id=wbdocuments_name__label for=wbdocuments_nameDocument name: /
label
/td
td class=w2p_fw
input id=wbdocuments_name class=string type=text value= name=name

/td
td class=w2p_fc/td
/tr
tr id=wbdocuments_file__row
td class=w2p_fl
label id=wbdocuments_file__label for=wbdocuments_fileDownload: /label

/td
td class=w2p_fw
input id=wbdocuments_file class=upload type=file name=file
/td
td class=w2p_fc/td
/tr
tr id=submit_record__row
td class=w2p_fl/td
td class=w2p_fw
input type=submit value=Submit
/td
td class=w2p_fc/td
/tr
/tbody
/table


I have tried
from splinter.browser import Browser
browser = Browser()
browser.visit('http://localhost:8000/init/wbank/addoc')

browser.fill('name', 'Part_A.pdf')
browser.fill('file', '/home/js/web2py/applications/akb/uploads/Part_A.pdf')


At this stage the form looks like the screenshot.  You will see that the
'name' field is empty.

Then
button = browser.find_by_css('button').first
button.click()

And the opened browser was  asking for an admin password and the record was
not in the table.


With mechanize I don't get further than this:

br.select_form(name = _formname)

FormNotFoundError: no form matching name '_formname'

I don't know how to use the form_id in this case:

 br.select_form(id = 'wbdocuments_name')
TypeError: select_form() got an unexpected keyword argument 'id'

Regards
Johann




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

Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Johann Spies
On 14 October 2011 12:31, Bruno Rocha rochacbr...@gmail.com wrote:

 note: you can do that on the server side. just need to put all the files
 directly under upload folder and loop throught them. So the store method can
 be used to create the record

 I want to do that on the server side.  What does this 'loop through' mean
in this case.  I have tried to do a db.table.insert but that only put the
name in the 'file' field and now upload took place.

Regards
Johann

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


[web2py] Re: Better off-line book?

2011-10-14 Thread DenesL

Thanks!

On Oct 14, 1:44 am, ma...@rockiger.com rocki...@googlemail.com
wrote:
 Hi Samuele,

 use wget:

 wget --recursive -l 1 --no-clobber --page-requisites --html-extension
 --convert-links --restrict-file-names=windows --domains web2py.com
 --no-parenthttp://www.web2py.com/book

 This way you get the whole book properly link. Everything ist in there.


[web2py] Re: serving a zip file

2011-10-14 Thread peter
I sent from my wifes email
http://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e48c79ad

However with hindsight I think I did not give sufficient information
in my forum entry. I guess I was seeing if other people had had
problems with downloading zip files.

Today, I just tried the following

def downloady():

import os
import contenttype as c
path=somepath/album.zip
response.headers['Content-Type'] = c.contenttype(path)
response.headers['Content-Disposition'] = 'attachment;
filename=album.zip'# to force download as attachment

return response.stream(open(path,'rb'),chunk_size=4096)

and this did work correctly. So I do not know why I was having
problems last month, when I repeatedly had problems with downloaded
zip files not unzipping.

So I aplogise for suggesting there was a bug here. I will see if I can
recreate the problems I was having and get to the root cause.

Peter



On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

  As I have reported previously in this forum, I think that
  response.stream does not quite stream zip files correctly.

 I have no bug report about this. Can you tell us more so we can fix it?


[web2py] Re: Represent, list:reference, upload-field

2011-10-14 Thread Massimo Di Pierro
My bad. Try this:

def render_docs(ids,row):
  span = SPAN()
  for id in ids:
 doc = db.wbdocuments(id)
 if doc:
span.append(A(doc.name,_href=URL('download',args=doc.file)))
  return span

db.wbmaster.documents.represent = render_docs

On Oct 14, 5:35 am, Johann Spies johann.sp...@gmail.com wrote:
 On 14 October 2011 11:14, Massimo Di Pierro massimo.dipie...@gmail.comwrote:

  documents is a list of IDs so you have to turn each one of them into a
  link. You can try:

  db.wbmaster.documents.represent = lambda value, row: SPAN(*[row.name]+
  [A(v, _href = URL('download', args = v)) for v in value])

  Hope I make sense.

  Yes, it does, thank you.

 But that also did not do the job.  I still got a '69' in stead of a list of
 names.  I have changed that to

 db.wbmaster.documents.represent = lambda value, row:
 [A(db.wbdocuments[v].name + ', ', _href = URL('download', args = v)) for v
 in value]

 (I am not sure how to use 'SPAN' in this case - or why) and now I get a list
 of links which is what I was looking for.
 But the links are wrong.  When clicked on the first link the URL 
 washttp://localhost:8000/init/wbank/download/6
 where it should have downloaded the record with id=6 from db.wbdocuments.

 Now I just get a 404 NOT FOUND.

 Regards
 Johann


Re: [web2py] Re: Uploading 388 files

2011-10-14 Thread Johann Spies
I apologise for not reading the book properly.  I have waisted many hours by
trying all sort of other stuff and in the end I could do just this:

import os
path = /home/js/web2py/applications/uploads  # insert the path to the
directory of interest here
dirList = os.listdir(path)
for fname in dirList:
fn = path + fname
stream = open(fn,'rb')
db.wbdocuments.insert(image=db.wbdocuments.name.store(stream,fn))
db.commit()

Thanks however to all the people trying to help me.  And I have learnt about
interesting tools what might be handy in other situations.

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


Re: [web2py] Re: Represent, list:reference, upload-field

2011-10-14 Thread Johann Spies
On 14 October 2011 14:49, Massimo Di Pierro massimo.dipie...@gmail.comwrote:

 My bad. Try this:

 def render_docs(ids,row):
  span = SPAN()
  for id in ids:
 doc = db.wbdocuments(id)
 if doc:
 span.append(A(doc.name,_href=URL('download',args=doc.file)))
  return span

 db.wbmaster.documents.represent = render_docs

 Fantastic.  Thanks

Johann

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


[web2py] Re: IMPORTANT

2011-10-14 Thread Massimo Di Pierro
On the one side sharing information about yourself on the list is a
good thing because other people will get to know you better. On the
other side you cannot be guaranteed other people like what they see
and if they do not they may not help you. For example consider of an
hypothetical user asking for technical help and telling us he/she is
building:

- propaganda site for a political party we oppose
- a site for a government that is at war with our country
- a tool for a religion that has caused oppression to our people
- a site to collect signatures to oppose religion in schools
- a tool for a religion that opposes certain life saving medical
treatments to kids
- a porn site
- an estore that sells meat
- an estore that sells chocolate not meeting the EU chocolate
directive (2000/36/EC)
- etc.

These are just examples of projects that some members of this list may
not want to provide support for. Of course different members for each
item.
And I do not mean to be discriminatory against ANY of the types of
projects I listed. I am just trying to get people in other people's
shoes.
Just keep it in mind. That is all.

If you want to tell who you are and what do fine. Some will like it,
some will not. All I ask you is that we avoid discussion on whether we
like it or not and we keep discussions to technical issues.

Massimo


Re: [web2py] Re: IMPORTANT

2011-10-14 Thread Bruno Rocha
http://zerp.ly/rochacbruno
Em 14/10/2011 10:26, Massimo Di Pierro massimo.dipie...@gmail.com
escreveu:

 On the one side sharing information about yourself on the list is a
 good thing because other people will get to know you better. On the
 other side you cannot be guaranteed other people like what they see
 and if they do not they may not help you. For example consider of an
 hypothetical user asking for technical help and telling us he/she is
 building:

 - propaganda site for a political party we oppose
 - a site for a government that is at war with our country
 - a tool for a religion that has caused oppression to our people
 - a site to collect signatures to oppose religion in schools
 - a tool for a religion that opposes certain life saving medical
 treatments to kids
 - a porn site
 - an estore that sells meat
 - an estore that sells chocolate not meeting the EU chocolate
 directive (2000/36/EC)
 - etc.

 These are just examples of projects that some members of this list may
 not want to provide support for. Of course different members for each
 item.
 And I do not mean to be discriminatory against ANY of the types of
 projects I listed. I am just trying to get people in other people's
 shoes.
 Just keep it in mind. That is all.

 If you want to tell who you are and what do fine. Some will like it,
 some will not. All I ask you is that we avoid discussion on whether we
 like it or not and we keep discussions to technical issues.

 Massimo


[web2py] malformed date in email.send

2011-10-14 Thread Alexey Nezhdanov
Hi web2py community.

My users complained that emails (sent through mail.send)
arrive dated by Jan 1st, 1970.
Quick investigation showed that it is due to localized date:
Date: пт, 14 окт 2011 13:16:56 +

I fixed it by dropping hand-made line and using one from email.utils
instead (there is already an 'from email import *' line at the
beginning so i didn't have to add an import):

--- tools.orig.py   2011-10-14 15:27:00.527823284 +0200
+++ tools.py2011-10-14 15:27:16.709040018 +0200
@@ -559,8 +559,7 @@
 if bcc:
 to.extend(bcc)
 payload['Subject'] = encode_header(subject.decode(encoding))
-payload['Date'] = time.strftime(%a, %d %b %Y %H:%M:%S +,
-time.gmtime())
+payload['Date'] = utils.formatdate()
 result = {}
 try:
 if self.settings.server == 'logging':

Regards
Alexey


[web2py] Re: serving a zip file

2011-10-14 Thread peter
If I now do exactly what I did one month ago, there is now no error
with zip streaming. So maybe you have changed things in
response.stream since then.

Peter

On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:
 I sent from my wifes 
 emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4...

 However with hindsight I think I did not give sufficient information
 in my forum entry. I guess I was seeing if other people had had
 problems with downloading zip files.

 Today, I just tried the following

 def downloady():

     import os
     import contenttype as c
     path=somepath/album.zip
     response.headers['Content-Type'] = c.contenttype(path)
     response.headers['Content-Disposition'] = 'attachment;
 filename=album.zip'# to force download as attachment

     return response.stream(open(path,'rb'),chunk_size=4096)

 and this did work correctly. So I do not know why I was having
 problems last month, when I repeatedly had problems with downloaded
 zip files not unzipping.

 So I aplogise for suggesting there was a bug here. I will see if I can
 recreate the problems I was having and get to the root cause.

 Peter

 On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:



  On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

   As I have reported previously in this forum, I think that
   response.stream does not quite stream zip files correctly.

  I have no bug report about this. Can you tell us more so we can fix it?- 
  Hide quoted text -

 - Show quoted text -


Re: [web2py] Re: Better off-line book?

2011-10-14 Thread ~redShadow~
On Thu, 2011-10-13 at 22:44 -0700, ma...@rockiger.com wrote:
 Hi Samuele,
 
 
 use wget:
 
 
 wget --recursive -l 1 --no-clobber --page-requisites --html-extension
 --convert-links --restrict-file-names=windows --domains web2py.com
 --no-parent http://www.web2py.com/book

Cool.. I tried playing with something similar but none worked.
Looks like --html-extension fixed many things.. 
-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  Software is like sex: it's better when it's free!
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: IMPORTANT

2011-10-14 Thread Gour
On Fri, 14 Oct 2011 10:29:43 -0300
Bruno Rocha rochacbr...@gmail.com wrote:

 http://zerp.ly/rochacbruno

I like it. ;)


Sincerely,
Gour


-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


[web2py] Re: IMPORTANT

2011-10-14 Thread Gour
On Fri, 14 Oct 2011 06:26:33 -0700 (PDT)
Massimo Di Pierro
massimo.dipie...@gmail.com wrote:

 On the other side you cannot be guaranteed other people like what they see
 and if they do not they may not help you. 

If I, as vegetarian, would e.g. desist from helping someone else due to him/her
being meat eater, I'd consider myself as lowest of mankind...however, I
understand your point and will live with it for the time I choose to be part of
this community.


Now, I've enough of this 'IMPORTANT' talk...


Sincerely,
Gour


-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


RE: [web2py] Re: Better off-line book?

2011-10-14 Thread Cameron
Whatever documentation is used, consider a monetary contribution or book
purchase to show appreciation for all the hours of fine work that contiually
go into the documentation and the project.
 
While there are many kinds of contributions (support, code, community, etc)
a monetary contribution has it's own unique value and utility and I'm sure
it will be greatly appreciated.


RE: [web2py] Re: Better off-line book?

2011-10-14 Thread ~redShadow~
On Fri, 2011-10-14 at 10:00 -0400, Cameron wrote: 
 Whatever documentation is used, consider a monetary contribution or
 book purchase to show appreciation for all the hours of fine work that
 contiually go into the documentation and the project.
  
 While there are many kinds of contributions (support, code, community,
 etc) a monetary contribution has it's own unique value and utility and
 I'm sure it will be greatly appreciated.

already done :)
(and of course I suggest doing the same, especially if you plan on using
web2py for your business..)

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  Software is like sex: it's better when it's free!
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


Re: [web2py] Re: Better off-line book?

2011-10-14 Thread villas
I agree.  I personally feel that as I use the book and the online version 
all the time,  the least I could do is pay for it once per year.  Of course 
it is one of the world's best bargains when compared to the effort which 
goes into producing it and the time which it can save me.  It is a wonderful 
asset to our community.


Re: [web2py] Re: IMPORTANT

2011-10-14 Thread Bruno Rocha
sometime ago I have been contacted by an user of this list asking me help
for a project.

After some messages, this user wanted me to develop an e-store for his
client. A big company and this would be a great project (he would pay a
large ammount of money for me)

so I discovered that it was a hunting stuff e-store. to sell hunting weapons
and taxidermy stuff.

I reject the job and for sure I did not helped him directly with this.

I am vegan and animal rights activist (abolitionist) for me is no go to work
in a project where animal exploitation is directly the goal. also I will
never directly work/help projects with any kind of racism, sexism or
speciesism.

But, generally we are here to help and contribute with open source community
and web development.

I will help anyone if I can, in technical issues even if I do not know the
purposes of the project.

And I will never be offended if some user writes a religious signature or
some sentence which invokes any kind of animal exploitation because I
understand that there are cultural limits and I am used to live with this.

So, I call you all to not be offended if I came with meat is murder or Go
vegan in my signature. I do not use this kind of propaganda here. but I
talk a lot about it in my social profiles.

I think it is very health to share our ideas and cultural differences, only
needs to be tolerant and keep focus on technical issues. which is the list
purpose. and if needed use other channels to discuss our politics.

http://zerp.ly/rochacbruno
Em 14/10/2011 10:54, Gour g...@atmarama.net escreveu:

 On Fri, 14 Oct 2011 06:26:33 -0700 (PDT)
 Massimo Di Pierro
 massimo.dipie...@gmail.com wrote:

  On the other side you cannot be guaranteed other people like what they
 see
  and if they do not they may not help you.

 If I, as vegetarian, would e.g. desist from helping someone else due to
 him/her
 being meat eater, I'd consider myself as lowest of mankind...however, I
 understand your point and will live with it for the time I choose to be
 part of
 this community.


 Now, I've enough of this 'IMPORTANT' talk...


 Sincerely,
 Gour


 --
 “In the material world, conceptions of good and bad are
 all mental speculations…” (Sri Caitanya Mahaprabhu)

 http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810





[web2py] Recipe: How to set up web2py + ldap with Windows Active Directory

2011-10-14 Thread Omi Chiba
There is only a brief explanation on official book
I'd like to share how I set it up at the company I work.

http://ochiba77.blogspot.com/2011/10/how-to-set-up-web2py-ldap-with-windows.html

This was a key feature I was looking over years to use web framework
in my intranet web site and web2py made it so easy !!! Now I can
confidently recommend web2py to our company and group companies in the
world.





[web2py] Re: IMPORTANT

2011-10-14 Thread villas
The number of posts suggests that a policy would be useful.  Many have said 
'live and let live' should be sufficient,  but I personally find that 
totally inadequate because it does not provide any definition at all and 
simply leaves this topic without any conclusion.  

I suggest we simply restrict our comments towards proposing how the policy 
should be written and here is my suggestion below.  Once we have a simple 
policy it might be amended in the light of experience...

This group is established to discuss all things related to Web2py and 
everyone is requested to bear this in mind when making posts.  If anyone 
wishes to personalise their signature to include their other interests or 
commercial affiliations that is fine,  but in the interests of reducing 
bandwidth and noise we request, as a guideline, that members restrict their 
signatures to no more than 120(?) characters.  Whilst everyone is encouraged 
to 'live and let live',  any sexist, racist, or otherwise discriminatory or 
insulting posts will not be tolerated. 


Re: [web2py] Re: serving a zip file

2011-10-14 Thread Matt Broadstone
On Fri, Oct 14, 2011 at 9:35 AM, peter peterchutchin...@gmail.com wrote:
 If I now do exactly what I did one month ago, there is now no error
 with zip streaming. So maybe you have changed things in
 response.stream since then.

 Peter

 On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:
 I sent from my wifes 
 emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4...

 However with hindsight I think I did not give sufficient information
 in my forum entry. I guess I was seeing if other people had had
 problems with downloading zip files.

 Today, I just tried the following

 def downloady():

     import os
     import contenttype as c
     path=somepath/album.zip
     response.headers['Content-Type'] = c.contenttype(path)
     response.headers['Content-Disposition'] = 'attachment;
 filename=album.zip'# to force download as attachment

     return response.stream(open(path,'rb'),chunk_size=4096)


Does this actually work for you? When I use this code, I get a
download, but it saves out a zero byte file with the proper name.



 and this did work correctly. So I do not know why I was having
 problems last month, when I repeatedly had problems with downloaded
 zip files not unzipping.

 So I aplogise for suggesting there was a bug here. I will see if I can
 recreate the problems I was having and get to the root cause.

 Peter

 On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:



  On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

   As I have reported previously in this forum, I think that
   response.stream does not quite stream zip files correctly.

  I have no bug report about this. Can you tell us more so we can fix it?- 
  Hide quoted text -

 - Show quoted text -


[web2py] data as showing left to join sqlform.grid

2011-10-14 Thread mmartinez
Hi list I need to do is display data in a sqlform.grid where I have a
query to a db with a left join.

This is the code

a = db.llamados
b = db.accountcode.with_alias ('b')
db.clientes.with_alias c = ('c')
db.rutas.with_alias r = ('r')
db.rutaproveedor.with_alias rp = ('rp')
form.accepts if (request.vars, session):
 dat = request.vars.desde
 DAT1 = request.vars.hasta
 dt1 = datetime.datetime (* time.strptime (dat, '% Y-% m-% d%
H:% M:% S') [0:6])
 dt2 = datetime.datetime (* time.strptime (DAT1, '% Y-% m-% d%
H:% M:% S') [0:6])
 left = (b.on (a.id_accountcode == b.id) rp.on (==
a.id_rutaproveedor rp.id) r.on (rp.id_rutas r.id ==))
 query = (db.llamados.dialstatus == 'ANSWER') 
(db.llamados.inicio = dt1)  (db.llamados.inicio = dt2)
 SQLFORM.grid RWS = (
 query,
 left = left,
 )


need to show the column 'rutas.nombre' and 'accountcode.ani'


[web2py] Re: Recipe: How to set up web2py + ldap with Windows Active Directory

2011-10-14 Thread Willoughby
Thanks for posting this!!


[web2py] Re: Recipe: How to set up web2py + ldap with Windows Active Directory

2011-10-14 Thread juanduke
look very very very simple! Great!

You win a new Python Roll reader ;)

thanks!


[web2py] Re: serving a zip file

2011-10-14 Thread Massimo Di Pierro
What browser?


On Oct 14, 10:30 am, Matt Broadstone mbroa...@gmail.com wrote:
 On Fri, Oct 14, 2011 at 9:35 AM, peter peterchutchin...@gmail.com wrote:
  If I now do exactly what I did one month ago, there is now no error
  with zip streaming. So maybe you have changed things in
  response.stream since then.

  Peter

  On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:
  I sent from my wifes 
  emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4...

  However with hindsight I think I did not give sufficient information
  in my forum entry. I guess I was seeing if other people had had
  problems with downloading zip files.

  Today, I just tried the following

  def downloady():

      import os
      import contenttype as c
      path=somepath/album.zip
      response.headers['Content-Type'] = c.contenttype(path)
      response.headers['Content-Disposition'] = 'attachment;
  filename=album.zip'# to force download as attachment

      return response.stream(open(path,'rb'),chunk_size=4096)

 Does this actually work for you? When I use this code, I get a
 download, but it saves out a zero byte file with the proper name.







  and this did work correctly. So I do not know why I was having
  problems last month, when I repeatedly had problems with downloaded
  zip files not unzipping.

  So I aplogise for suggesting there was a bug here. I will see if I can
  recreate the problems I was having and get to the root cause.

  Peter

  On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

As I have reported previously in this forum, I think that
response.stream does not quite stream zip files correctly.

   I have no bug report about this. Can you tell us more so we can fix it?- 
   Hide quoted text -

  - Show quoted text -


Re: [web2py] Some say local_import is deprecated. Is it?

2011-10-14 Thread Vinicius Assef
Where is the nem import system documented or where can we know more
details about it?


On Fri, Oct 14, 2011 at 3:24 AM, Bruno Rocha rochacbr...@gmail.com wrote:
 It is still supported and should work, but it is deprecated and encouraged
 to use the new import system

 On Fri, Oct 14, 2011 at 3:22 AM, seongjoo seongjoo@gmail.com wrote:

 While solving some problems of importing module, I found a web article
 that contains some argument saying that local_import is deprecated.

 http://comments.gmane.org/gmane.comp.python.web2py/67885

 The web2py book (ed 3.1) has no mention about local_import being
 deprecated, so I would like to know it is or it is not.




 --



 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]
 [ Aprenda a programar: http://CursoDePython.com.br ]
 [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
 [ Consultoria em desenvolvimento web: http://www.blouweb.com ]



Re: [web2py] Re: serving a zip file

2011-10-14 Thread Matt Broadstone
On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 What browser?
That was chrome. The previously fix suggested by Brian works for me (thanks!).

Matt

 On Oct 14, 10:30 am, Matt Broadstone mbroa...@gmail.com wrote:
 On Fri, Oct 14, 2011 at 9:35 AM, peter peterchutchin...@gmail.com wrote:
  If I now do exactly what I did one month ago, there is now no error
  with zip streaming. So maybe you have changed things in
  response.stream since then.

  Peter

  On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:
  I sent from my wifes 
  emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4...

  However with hindsight I think I did not give sufficient information
  in my forum entry. I guess I was seeing if other people had had
  problems with downloading zip files.

  Today, I just tried the following

  def downloady():

      import os
      import contenttype as c
      path=somepath/album.zip
      response.headers['Content-Type'] = c.contenttype(path)
      response.headers['Content-Disposition'] = 'attachment;
  filename=album.zip'# to force download as attachment

      return response.stream(open(path,'rb'),chunk_size=4096)

 Does this actually work for you? When I use this code, I get a
 download, but it saves out a zero byte file with the proper name.







  and this did work correctly. So I do not know why I was having
  problems last month, when I repeatedly had problems with downloaded
  zip files not unzipping.

  So I aplogise for suggesting there was a bug here. I will see if I can
  recreate the problems I was having and get to the root cause.

  Peter

  On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

As I have reported previously in this forum, I think that
response.stream does not quite stream zip files correctly.

   I have no bug report about this. Can you tell us more so we can fix 
   it?- Hide quoted text -

  - Show quoted text -


[web2py] Re: IMPORTANT

2011-10-14 Thread Gour
On Fri, 14 Oct 2011 11:27:20 -0300
Bruno Rocha rochacbr...@gmail.com wrote:

 sometime ago I have been contacted by an user of this list asking me
 help for a project.
 
 After some messages, this user wanted me to develop an e-store for his
 client. A big company and this would be a great project (he would pay
 a large ammount of money for me)
 
 so I discovered that it was a hunting stuff e-store. to sell hunting
 weapons and taxidermy stuff.
 
 I reject the job and for sure I did not helped him directly with this.

I would probably do the same...but that falls into case where someone is openly
against some group, principles etc.

 I am vegan and animal rights activist (abolitionist) for me is no go
 to work in a project where animal exploitation is directly the goal.

I fully agree with that, but what is the difference if e.g. you're helping the
project which has animal exploatation as its goal or you're helping people to
make money in some other project and buy meat in the butcher shop?

Don't be in illusion that your karmic share is much different in the latter 
case.

 also I will never directly work/help projects with any kind of
 racism, sexism or speciesism.

However, I would not mix *belief* and *deeds*.

People complained about the religious BELIEF (maybe I am also included) which
Johann expresses in his signature and not about what he DOES which, imho, makes
a big difference.

You're aware that the leader of this project is non-vegetarian and I buy his
book I'm helping him to buy the meat.

Still, I feel that if I receive something from someone (web2py in this case)
who puts his time, energy etc. into it, then, there is no harm by contributing
back.

Moreover, after coming to know that our leader is non-vegetarian does not make
him less worthy in my eyes...I was also born as meat-eater and by showing nice
example to other people, we may help them to raise their consciousness and
awareness.

Here is inspiring post from someone I highly admire (knowing him from my
Haskell times) who is religious person showing nice attitude towards those who
are different. (higgly recommended to read!)

http://changelog.complete.org/archives/7253-an-incredible-story-from-soviet-times


Sincerely,
Gour
 

-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


[web2py] Re: IMPORTANT

2011-10-14 Thread elffikk
We welcome people of any gender identity or expression, race,
ethnicity, size, nationality, sexual orientation, ability level,
religion, culture, subculture, and  political opinion

+1

for me that means that Johan has the right to include his signature,
as we accept him,

that speaks about himself, not against others,
that tells us about his religion not that he is against other
religions

forcing him to remove his signature is exactly the opposite of
accepting people of all religions






Re: [web2py] Re: IMPORTANT

2011-10-14 Thread Bruno Rocha
http://zerp.ly/rochacbruno
Em 14/10/2011 16:15, Gour g...@atmarama.net escreveu:

 On Fri, 14 Oct 2011 11:27:20 -0300
 Bruno Rocha rochacbr...@gmail.com wrote:

  sometime ago I have been contacted by an user of this list asking me
  help for a project.
 
  After some messages, this user wanted me to develop an e-store for his
  client. A big company and this would be a great project (he would pay
  a large ammount of money for me)
 
  so I discovered that it was a hunting stuff e-store. to sell hunting
  weapons and taxidermy stuff.
 
  I reject the job and for sure I did not helped him directly with this.

 I would probably do the same...but that falls into case where someone is
openly
 against some group, principles etc.

  I am vegan and animal rights activist (abolitionist) for me is no go
  to work in a project where animal exploitation is directly the goal.

 I fully agree with that, but what is the difference if e.g. you're helping
the
 project which has animal exploatation as its goal or you're helping people
to
 make money in some other project and buy meat in the butcher shop?

no difference and I do not support any case. but eating meat is a cultural
thing and sometimed I agree it is/was needed.

btw, hunting is completelly superfluous, this is no more a cultural habit
and we have laws againt it in some places. I agree both cases are
exploitation but different in therms of tolerance.


 Don't be in illusion that your karmic share is much different in the
latter case.

sorry, but I dont believe in karma or things like that.


  also I will never directly work/help projects with any kind of
  racism, sexism or speciesism.

 However, I would not mix *belief* and *deeds*.

BTW I have no *belief*


 People complained about the religious BELIEF (maybe I am also included)
which
 Johann expresses in his signature and not about what he DOES which, imho,
makes
 a big difference.
sometimes religious says and teach people how to perform racism, sexism or
speciesism, because of that I give it as example.
but I persinally dont care about it.


 You're aware that the leader of this project is non-vegetarian and I buy
his
 book I'm helping him to buy the meat.
completelly different situation, all the world is doing animal exploitation
(may be I am included in some cases) but there are people who agree with the
benefits of less exploitation.
this is a conplicate subject and may be we can discuss ut in another
channel.


 Still, I feel that if I receive something from someone (web2py in this
case)
 who puts his time, energy etc. into it, then, there is no harm by
contributing
 back.

as I say. I always contribute with everyone and with the project, I just
dont fell confortable to work directly with things who breaks my principles.


 Moreover, after coming to know that our leader is non-vegetarian does not
make
 him less worthy in my eyes...I was also born as meat-eater and by showing
nice
 example to other people, we may help them to raise their consciousness and
 awareness.

Yes, and it is true.  nobody is less worthy as you said. Every being in this
world has the same rights.


 Here is inspiring post from someone I highly admire (knowing him from my
 Haskell times) who is religious person showing nice attitude towards those
who
 are different. (higgly recommended to read!)


http://changelog.complete.org/archives/7253-an-incredible-story-from-soviet-times

I will take a look



 Sincerely,
 Gour


 --
 “In the material world, conceptions of good and bad are
 all mental speculations…” (Sri Caitanya Mahaprabhu)

Suffering, Slaughter, Starvation, Prejudice are bad for any kind of being
and I know it is not a mental speculation.


 http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810



I agree we have to *let it be* and focus this community only in technical
issues.

other things we can discuss in another channel or privatelly.


[web2py] Re: criticism of web2py

2011-10-14 Thread Gour
On Wed, 5 Oct 2011 10:46:01 -0700 (PDT)
Massimo Di Pierro
massimo.dipie...@gmail.com wrote:

 Instant-press is the de-fact CMS and I think it can be packaged with
 other apps (for example PyForum, pyStack, IssueTracker, etc) to build
 a suite of production tools perhaps using federated authentication.

What do you think about having some roadmap for Instant Press in order to know
what is planned in nearby future and how one could help make it appear?

I'm (probably) not aware of all the modern web technologies, but still believe
that having established CMS/blog won't hurt (further) adoption of web2px
althougjh I hear (some) voices from the camps of other frameworks explaining
CMS is old technology. If this it the case, I'd like to know more about it...


Sincerely,
Gour


-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


Re: [web2py] Some say local_import is deprecated. Is it?

2011-10-14 Thread Bruno Rocha
the custom_importer is implemented in a transpatent way.

you only have to use normal imports.

from module import object

this has adittional feature to track changes in modules.

track_changes()

I guess it is not doccumented yet.

http://zerp.ly/rochacbruno
Em 14/10/2011 14:45, Vinicius Assef vinicius...@gmail.com escreveu:

 Where is the nem import system documented or where can we know more
 details about it?


 On Fri, Oct 14, 2011 at 3:24 AM, Bruno Rocha rochacbr...@gmail.com
 wrote:
  It is still supported and should work, but it is deprecated and
 encouraged
  to use the new import system
 
  On Fri, Oct 14, 2011 at 3:22 AM, seongjoo seongjoo@gmail.com
 wrote:
 
  While solving some problems of importing module, I found a web article
  that contains some argument saying that local_import is deprecated.
 
  http://comments.gmane.org/gmane.comp.python.web2py/67885
 
  The web2py book (ed 3.1) has no mention about local_import being
  deprecated, so I would like to know it is or it is not.
 
 
 
 
  --
 
 
 
  --
  Bruno Rocha
  [ About me: http://zerp.ly/rochacbruno ]
  [ Aprenda a programar: http://CursoDePython.com.br ]
  [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
  [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
 



[web2py] Re: IMPORTANT

2011-10-14 Thread Gour
On Fri, 14 Oct 2011 17:46:54 -0300
Bruno Rocha rochacbr...@gmail.com wrote:

 Suffering, Slaughter, Starvation, Prejudice are bad for any kind of
 being and I know it is not a mental speculation.

Try to get hold of this book:

http://www.amazon.com/Maya-World-as-Virtual-Reality/dp/0963530909/ref=sr_1_1?ie=UTF8qid=1318626261sr=8-1


Sincerely,
Gour


-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


Re: [web2py] Re: Recipe: How to set up web2py + ldap with Windows Active Directory

2011-10-14 Thread António Ramos
Does this approach works with Novell Directory?

2011/10/14 juanduke juan.fu...@gmail.com

 look very very very simple! Great!

 You win a new Python Roll reader ;)

 thanks!



Re: [web2py] Re: Recipe: How to set up web2py + ldap with Windows Active Directory

2011-10-14 Thread Bruno Rocha
does work with openldap?

http://zerp.ly/rochacbruno
Em 14/10/2011 18:16, António Ramos ramstei...@gmail.com escreveu:

 Does this approach works with Novell Directory?

 2011/10/14 juanduke juan.fu...@gmail.com

 look very very very simple! Great!

 You win a new Python Roll reader ;)

 thanks!





[web2py] Re: Help with git and fluxflex

2011-10-14 Thread ma...@rockiger.com
Do you ignore the sqlite-file?

Can you Post the content of you .gitignore


[web2py] Re: Recipe: How to set up web2py + ldap with Windows Active Directory

2011-10-14 Thread Omi Chiba
Antonio, Burno,

I don't have environment to test... please try !
This blog entry is also shared at web2py slice.

http://www.web2pyslices.com/slices/take_slice/145

On Oct 14, 4:28 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 does work with openldap?

 http://zerp.ly/rochacbruno
 Em 14/10/2011 18:16, António Ramos ramstei...@gmail.com escreveu:







  Does this approach works with Novell Directory?

  2011/10/14 juanduke juan.fu...@gmail.com

  look very very very simple! Great!

  You win a new Python Roll reader ;)

  thanks!


Re: [web2py] Some say local_import is deprecated. Is it?

2011-10-14 Thread Martín Mulone
http://www.slideshare.net/martinpm/web2py-pensando-en-grande-9448110
slides from 13 to 20.

2011/10/14 Bruno Rocha rochacbr...@gmail.com

 the custom_importer is implemented in a transpatent way.

 you only have to use normal imports.

 from module import object

 this has adittional feature to track changes in modules.

 track_changes()

 I guess it is not doccumented yet.

 http://zerp.ly/rochacbruno
 Em 14/10/2011 14:45, Vinicius Assef vinicius...@gmail.com escreveu:

 Where is the nem import system documented or where can we know more
 details about it?


 On Fri, Oct 14, 2011 at 3:24 AM, Bruno Rocha rochacbr...@gmail.com
 wrote:
  It is still supported and should work, but it is deprecated and
 encouraged
  to use the new import system
 
  On Fri, Oct 14, 2011 at 3:22 AM, seongjoo seongjoo@gmail.com
 wrote:
 
  While solving some problems of importing module, I found a web article
  that contains some argument saying that local_import is deprecated.
 
  http://comments.gmane.org/gmane.comp.python.web2py/67885
 
  The web2py book (ed 3.1) has no mention about local_import being
  deprecated, so I would like to know it is or it is not.
 
 
 
 
  --
 
 
 
  --
  Bruno Rocha
  [ About me: http://zerp.ly/rochacbruno ]
  [ Aprenda a programar: http://CursoDePython.com.br ]
  [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br]
  [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
 




-- 
 http://martin.tecnodoc.com.ar


[web2py] Design Issue

2011-10-14 Thread Harshad
I am trying to create a web app that allows you to control various devices 
simultaneously. The simplified design is as follows:

   - One main background process continuously polls a database table for any 
   device control requests
  - Once it sees a request, it spawns two threads: send and receive 
  thread
   - Send thread periodically polls the commands table
   - Receive thread updates the responses table
   - The view basically writes to the commands table and polls the responses 
   table 

First of all, is this a good design? Should the communication between the 
threads and the view be through the database (SQLite)? Also, its worth 
mentioning that there the database is updated quite often since the device 
is being controlled in real-time.


[web2py] Re: serving a zip file

2011-10-14 Thread Massimo Di Pierro
I understand. The problem is that response.stream does not form for a
StringIO which is not a regular file. StringIO is in memory therefore
you have no reason for streaming.

filename = %s-backup % (time.strftime(%Y%m%d-%H%M))
raw_data = a bunch of data
stream = cStringIO.StringIO()
zip_file = zipfile.ZipFile(stream, w, zipfile.ZIP_DEFLATED,
False)
zip_file.writestr(filename, raw_data)
response.headers['Content-Type'] = application/octet-stream
response.headers['Content-Disposition'] = attachment;
filename=%s%s.bin % (time.strftime(%Y%m%d-%H%M), filename)
return stream.getvalue() ###  I only changed this

On Oct 14, 1:13 pm, Matt Broadstone mbroa...@gmail.com wrote:
 On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di 
 Pierromassimo.dipie...@gmail.com wrote:
  What browser?

 That was chrome. The previously fix suggested by Brian works for me (thanks!).

 Matt









  On Oct 14, 10:30 am, Matt Broadstone mbroa...@gmail.com wrote:
  On Fri, Oct 14, 2011 at 9:35 AM, peter peterchutchin...@gmail.com wrote:
   If I now do exactly what I did one month ago, there is now no error
   with zip streaming. So maybe you have changed things in
   response.stream since then.

   Peter

   On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:
   I sent from my wifes 
   emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4...

   However with hindsight I think I did not give sufficient information
   in my forum entry. I guess I was seeing if other people had had
   problems with downloading zip files.

   Today, I just tried the following

   def downloady():

       import os
       import contenttype as c
       path=somepath/album.zip
       response.headers['Content-Type'] = c.contenttype(path)
       response.headers['Content-Disposition'] = 'attachment;
   filename=album.zip'# to force download as attachment

       return response.stream(open(path,'rb'),chunk_size=4096)

  Does this actually work for you? When I use this code, I get a
  download, but it saves out a zero byte file with the proper name.

   and this did work correctly. So I do not know why I was having
   problems last month, when I repeatedly had problems with downloaded
   zip files not unzipping.

   So I aplogise for suggesting there was a bug here. I will see if I can
   recreate the problems I was having and get to the root cause.

   Peter

   On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

 As I have reported previously in this forum, I think that
 response.stream does not quite stream zip files correctly.

I have no bug report about this. Can you tell us more so we can fix 
it?- Hide quoted text -

   - Show quoted text -


[web2py] Re: criticism of web2py

2011-10-14 Thread Massimo Di Pierro
The community should write such road map and work to achieve it.

For now my priorities are:
- finish the book (4th ed)
- finish the web2py recipes book
- group plugins in one place
- deprecate web2py.com/applications and consolidate the good ones


On Oct 14, 3:55 pm, Gour g...@atmarama.net wrote:
 On Wed, 5 Oct 2011 10:46:01 -0700 (PDT)
 Massimo Di Pierro

 massimo.dipie...@gmail.com wrote:
  Instant-press is the de-fact CMS and I think it can be packaged with
  other apps (for example PyForum, pyStack, IssueTracker, etc) to build
  a suite of production tools perhaps using federated authentication.

 What do you think about having some roadmap for Instant Press in order to know
 what is planned in nearby future and how one could help make it appear?

 I'm (probably) not aware of all the modern web technologies, but still believe
 that having established CMS/blog won't hurt (further) adoption of web2px
 althougjh I hear (some) voices from the camps of other frameworks explaining
 CMS is old technology. If this it the case, I'd like to know more about 
 it...

 Sincerely,
 Gour

 --
 “In the material world, conceptions of good and bad are
 all mental speculations…” (Sri Caitanya Mahaprabhu)

 http://atmarama.net| Hlapicina (Croatia) | GPG: 52B5C810

  signature.asc
  1KViewDownload


[web2py] Re: serving a zip file

2011-10-14 Thread peter
Okay this is where I am now.

My example 'downloady' above works correctly in chrome but incorrectly
in IE8. In IE8, the file appears to download correctly but will not
unzip.

Peter

On Oct 14, 7:13 pm, Matt Broadstone mbroa...@gmail.com wrote:
 On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di 
 Pierromassimo.dipie...@gmail.com wrote:
  What browser?

 That was chrome. The previously fix suggested by Brian works for me (thanks!).

 Matt





  On Oct 14, 10:30 am, Matt Broadstone mbroa...@gmail.com wrote:
  On Fri, Oct 14, 2011 at 9:35 AM, peter peterchutchin...@gmail.com wrote:
   If I now do exactly what I did one month ago, there is now no error
   with zip streaming. So maybe you have changed things in
   response.stream since then.

   Peter

   On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:
   I sent from my wifes 
   emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4...

   However with hindsight I think I did not give sufficient information
   in my forum entry. I guess I was seeing if other people had had
   problems with downloading zip files.

   Today, I just tried the following

   def downloady():

       import os
       import contenttype as c
       path=somepath/album.zip
       response.headers['Content-Type'] = c.contenttype(path)
       response.headers['Content-Disposition'] = 'attachment;
   filename=album.zip'# to force download as attachment

       return response.stream(open(path,'rb'),chunk_size=4096)

  Does this actually work for you? When I use this code, I get a
  download, but it saves out a zero byte file with the proper name.

   and this did work correctly. So I do not know why I was having
   problems last month, when I repeatedly had problems with downloaded
   zip files not unzipping.

   So I aplogise for suggesting there was a bug here. I will see if I can
   recreate the problems I was having and get to the root cause.

   Peter

   On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

 As I have reported previously in this forum, I think that
 response.stream does not quite stream zip files correctly.

I have no bug report about this. Can you tell us more so we can fix 
it?- Hide quoted text -

   - Show quoted text -- Hide quoted text -

 - Show quoted text -


[web2py] Re: IMPORTANT

2011-10-14 Thread Massimo Di Pierro
You see why I wanted to close this thread? We are now discussing
something which is not web2py related.

I take full responsibility for opening it. We have achieved awareness.
This list has become a self conscious being.
Now I think we should close the discussion. At the same time I
encourage members interested in this topic to open a different mailing
list on on moral, ethics, and software mailing lists. There may be
something more here that can even lead to an interesting research
project and publications.

Massimo



[web2py] Re: serving a zip file

2011-10-14 Thread Massimo Di Pierro
You mean the downloaded file is corrupted? Can you check the size?

On Oct 14, 5:33 pm, peter peterchutchin...@gmail.com wrote:
 Okay this is where I am now.

 My example 'downloady' above works correctly in chrome but incorrectly
 in IE8. In IE8, the file appears to download correctly but will not
 unzip.

 Peter

 On Oct 14, 7:13 pm, Matt Broadstone mbroa...@gmail.com wrote:







  On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di 
  Pierromassimo.dipie...@gmail.com wrote:
   What browser?

  That was chrome. The previously fix suggested by Brian works for me 
  (thanks!).

  Matt

   On Oct 14, 10:30 am, Matt Broadstone mbroa...@gmail.com wrote:
   On Fri, Oct 14, 2011 at 9:35 AM, peter peterchutchin...@gmail.com 
   wrote:
If I now do exactly what I did one month ago, there is now no error
with zip streaming. So maybe you have changed things in
response.stream since then.

Peter

On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:
I sent from my wifes 
emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4...

However with hindsight I think I did not give sufficient information
in my forum entry. I guess I was seeing if other people had had
problems with downloading zip files.

Today, I just tried the following

def downloady():

    import os
    import contenttype as c
    path=somepath/album.zip
    response.headers['Content-Type'] = c.contenttype(path)
    response.headers['Content-Disposition'] = 'attachment;
filename=album.zip'# to force download as attachment

    return response.stream(open(path,'rb'),chunk_size=4096)

   Does this actually work for you? When I use this code, I get a
   download, but it saves out a zero byte file with the proper name.

and this did work correctly. So I do not know why I was having
problems last month, when I repeatedly had problems with downloaded
zip files not unzipping.

So I aplogise for suggesting there was a bug here. I will see if I can
recreate the problems I was having and get to the root cause.

Peter

On Oct 14, 12:22 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:

 On Oct 13, 12:46 pm, peter peterchutchin...@gmail.com wrote:

  As I have reported previously in this forum, I think that
  response.stream does not quite stream zip files correctly.

 I have no bug report about this. Can you tell us more so we can fix 
 it?- Hide quoted text -

- Show quoted text -- Hide quoted text -

  - Show quoted text -


Re: [web2py] Re: criticism of web2py

2011-10-14 Thread Bruno Rocha

 - group plugins in one place
 - deprecate web2py.com/applications and consolidate the good ones


Take github as an option for doing that!


Re: [web2py] Re: IMPORTANT

2011-10-14 Thread Vasile Ermicioi
yes, please close it and let us live in peace with each other


[web2py] Re: criticism of web2py

2011-10-14 Thread Massimo Di Pierro
I will.

On Oct 14, 5:50 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  - group plugins in one place
  - deprecate web2py.com/applications and consolidate the good ones

 Take github as an option for doing that!


[web2py] Re: migrate file system uploads to database?

2011-10-14 Thread Paul Gerrard
Hi all,

I have the same requirement - moving a directory of upload files into
the database. I was thinking the way to do it would be to copy the
original table definition, then make the field changes to the table
definitions, then write a script to process all the file-based records
and post them into the new table. Sounds simple but probably isn't.

Has anyone got a working script to do this perhaps?

Paul.



Re: [web2py] Re: criticism of web2py

2011-10-14 Thread Farsheed Ashouri
And probably we should consider porting web2py to python 3.

On Saturday, October 15, 2011, Massimo Di Pierro wrote:

 I will.

 On Oct 14, 5:50 pm, Bruno Rocha rochacbr...@gmail.com javascript:;
 wrote:
   - group plugins in one place
   - deprecate web2py.com/applications and consolidate the good ones
 
  Take github as an option for doing that!



-- 
Sincerely,
Farsheed Ashouri,
ourway.ir
Tel: +98 9388801504


[web2py] Re: Some say local_import is deprecated. Is it?

2011-10-14 Thread seongjoo
Oh, I think the original comment was from you. Thank you for the
clarification.

On 10월14일, 오후3시24분, Bruno Rocha rochacbr...@gmail.com wrote:
 It is still supported and should work, but it is deprecated and encouraged
 to use the new import system

 On Fri, Oct 14, 2011 at 3:22 AM, seongjoo seongjoo@gmail.com wrote:
  While solving some problems of importing module, I found a web article
  that contains some argument saying that local_import is deprecated.

 http://comments.gmane.org/gmane.comp.python.web2py/67885

  The web2py book (ed 3.1) has no mention about local_import being
  deprecated, so I would like to know it is or it is not.

 --

 --
 Bruno Rocha
 [ About me:http://zerp.ly/rochacbruno]
 [ Aprenda a programar:http://CursoDePython.com.br]
 [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
 [ Consultoria em desenvolvimento web:http://www.blouweb.com]


Re: [web2py] Re: criticism of web2py

2011-10-14 Thread Bruno Rocha
On Fri, Oct 14, 2011 at 9:38 PM, Farsheed Ashouri 
farsheed.asho...@gmail.com wrote:

 And probably we should consider porting web2py to python 3.


That't not on the roadmap... in the future will be a web3py but not now.
(may be web3py will be a completelly different project with the same goals)


[web2py] Re: Some say local_import is deprecated. Is it?

2011-10-14 Thread seongjoo
track_changes() is a very nice feature to have. It's somewhat tricky
to deal with python module import while in development. I would love
to have track_changes() like dynamic reloading (reload only if there
is some changes in the module) for basic python.

On 10월15일, 오전5시59분, Bruno Rocha rochacbr...@gmail.com wrote:
 the custom_importer is implemented in a transpatent way.

 you only have to use normal imports.

 from module import object

 this has adittional feature to track changes in modules.

 track_changes()

 I guess it is not doccumented yet.

 http://zerp.ly/rochacbruno
 Em 14/10/2011 14:45, Vinicius Assef vinicius...@gmail.com escreveu:







  Where is the nem import system documented or where can we know more
  details about it?

  On Fri, Oct 14, 2011 at 3:24 AM, Bruno Rocha rochacbr...@gmail.com
  wrote:
   It is still supported and should work, but it is deprecated and
  encouraged
   to use the new import system

   On Fri, Oct 14, 2011 at 3:22 AM, seongjoo seongjoo@gmail.com
  wrote:

   While solving some problems of importing module, I found a web article
   that contains some argument saying that local_import is deprecated.

  http://comments.gmane.org/gmane.comp.python.web2py/67885

   The web2py book (ed 3.1) has no mention about local_import being
   deprecated, so I would like to know it is or it is not.

   --

   --
   Bruno Rocha
   [ About me:http://zerp.ly/rochacbruno]
   [ Aprenda a programar:http://CursoDePython.com.br]
   [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
   [ Consultoria em desenvolvimento web:http://www.blouweb.com]


Re: [web2py] Re: criticism of web2py

2011-10-14 Thread Anthony
On Friday, October 14, 2011 8:54:23 PM UTC-4, rochacbruno wrote:

 On Fri, Oct 14, 2011 at 9:38 PM, Farsheed Ashouri 
 farsheed...@gmail.comwrote:

 And probably we should consider porting web2py to python 3.


 That't not on the roadmap... in the future will be a web3py but not now. 
 (may be web3py will be a completelly different project with the same goals) 


FYI, the reason it's not on the roadmap is because it would break backward 
compatibility. 


Re: [web2py] Re: Some say local_import is deprecated. Is it?

2011-10-14 Thread Bruno Rocha
2011/10/14 seongjoo seongjoo@gmail.com

 track_changes() is a very nice feature to have. It's somewhat tricky
 to deal with python module import while in development. I would love
 to have track_changes() like dynamic reloading (reload only if there
 is some changes in the module) for basic python.


look this: http://www.indelible.org/ink/python-reloading/


[web2py] Re: criticism of web2py

2011-10-14 Thread Massimo Di Pierro
No.
Web2py cannot run on 3 because of backward compatibility.
There will be a web3py that runs on python 3 but it will not be just a
port of web2py because we will take the occasion for a major overhaul.



On Oct 14, 7:38 pm, Farsheed Ashouri farsheed.asho...@gmail.com
wrote:
 And probably we should consider porting web2py to python 3.

 On Saturday, October 15, 2011, Massimo Di Pierro wrote:
  I will.

  On Oct 14, 5:50 pm, Bruno Rocha rochacbr...@gmail.com javascript:;
  wrote:
- group plugins in one place
- deprecate web2py.com/applications and consolidate the good ones

   Take github as an option for doing that!

 --
 Sincerely,
 Farsheed Ashouri,
 ourway.ir
 Tel: +98 9388801504


[web2py] Re: Some say local_import is deprecated. Is it?

2011-10-14 Thread Massimo Di Pierro
This is similar to what web2py/gluon/custom_import.py does.

On Oct 14, 8:13 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 2011/10/14 seongjoo seongjoo@gmail.com

  track_changes() is a very nice feature to have. It's somewhat tricky
  to deal with python module import while in development. I would love
  to have track_changes() like dynamic reloading (reload only if there
  is some changes in the module) for basic python.

 look this:http://www.indelible.org/ink/python-reloading/


[web2py] Does Python Scale?

2011-10-14 Thread Jonathan Lundell
Makes sense to me. If you care to substitute 'web2py' for 'python' you can come 
to pretty much the same conclusion. The choice of web2py influences your 
architecture, of course, but it neither prevents nor guarantees scalability.


Does Python Scale?
Mitch Garnaat
10/14/11 10:45 AM
Elastician
I wonder how many times I've been asked that question over the years.  Often, 
it's not even in the form of a question (Sorry, Mr. Trebek) but rather stated 
emphatically; Python doesn't scale.  This can be the start of long, heated 
discussions involving Global Interpreter Locks, interpreters vs. compilers, 
dynamic vs. static typing, etc.  These discussions rarely end satisfactorily 
for any of the parties involved.  And rarely are any opinions changed as a 
result.
So, does Python scale?

Well, YouTube is written mostly in Python.  DropBox is written almost entirely 
in Python.  Reddit.  Quora.  Disqus.  FriendFeed.  These are huge sites, 
handling gazillions of hits a day.  They are written in Python.  Therefore, 
Python scales.

Yeah, but what about that web app I wrote that one time.  Hosted on a cheapo, 
oversubscribed VPS, running straight CGI talking to a remote MySQL database 
running in a virtual machine on my Macbook Air.  That thing fell over like a 
drunken sailor when I invited a few of my friends to go check it out.  So, 
yeah.  Forget what I said before.  Obviously Python doesn't scale.

The truth is, it's the wrong question.  The stuff that allows Dropbox to store 
a million files every 15 minutes has little to do with Python just as the 
things that caused my feeble web app to fail had little to do with Python.  It 
has to do with the overall architecture of the application.  How databases are 
sharded, how loosely or tightly components have been coupled, how you monitor, 
and how you react to the data your monitoring is providing you.  And lots of 
other stuff.  But you have to deal with those issues no matter what language 
you write the system in.

No reasonable choice of computer language is going to guarantee your success or 
your failure.  So pick the one you are most productive in and focus on properly 
architecting your app.  That scales.
inline: 1231480044619721857-1682894398409005844.gif

Re: [web2py] Re: criticism of web2py

2011-10-14 Thread Jonathan Lundell
On Oct 14, 2011, at 6:28 PM, Massimo Di Pierro wrote:

 No.
 Web2py cannot run on 3 because of backward compatibility.
 There will be a web3py that runs on python 3 but it will not be just a
 port of web2py because we will take the occasion for a major overhaul.

Though if we had an overhauled version of web2py ready right now that required 
Python 3, it'd be a real PITA to deploy.

 
 
 
 On Oct 14, 7:38 pm, Farsheed Ashouri farsheed.asho...@gmail.com
 wrote:
 And probably we should consider porting web2py to python 3.
 
 On Saturday, October 15, 2011, Massimo Di Pierro wrote:
 I will.
 
 On Oct 14, 5:50 pm, Bruno Rocha rochacbr...@gmail.com javascript:;
 wrote:
 - group plugins in one place
 - deprecate web2py.com/applications and consolidate the good ones
 
 Take github as an option for doing that!
 
 --
 Sincerely,
 Farsheed Ashouri,
 ourway.ir
 Tel: +98 9388801504




[web2py] Re: migrate file system uploads to database?

2011-10-14 Thread Massimo Di Pierro
Say you have

db.define_table('mytable',Field('file','upload'))

step 1: add a blob

db.define_table('mytable',Field('file','upload',uploadfield='fileblob'),Field('fileblob','blob')

step 2 move the data in blob:

for row in db(db.mytable).select():
if row.file and not row.fileblob:
   data =
open(os.path.join(request.folder,'uploads',row.file),'rb').read()
   row.update_record(fileblob=data)
   db.commit()

Done

On Oct 14, 6:16 pm, Paul Gerrard p...@gerrardconsulting.com wrote:
 Hi all,

 I have the same requirement - moving a directory of upload files into
 the database. I was thinking the way to do it would be to copy the
 original table definition, then make the field changes to the table
 definitions, then write a script to process all the file-based records
 and post them into the new table. Sounds simple but probably isn't.

 Has anyone got a working script to do this perhaps?

 Paul.


[web2py] plugin_wiki crud and auth

2011-10-14 Thread pinwc4
I am attempting to use plugin_wiki with an app I have been developing
but am encountering a problem.  The application itself uses CRUD and I
have integrated CRUD with auth by adding the line crud.settings.auth =
auth in my model.

Unfortunately when I attempt to use plugin_wiki to edit pages I get a
not authorized error message.  It will create the page but not let me
edit.  If I remove the crud.settings.auth = auth line plugin_wiki
works correctly.  But I need that settings so that auth is enforced on
my various CRUD forms.

I was wondering if there is some configuration option or something
that I am missing that will allow plugin_wiki to work when CRUD is
integrated with auth?  From a brief look at the code it does not
appear to be the case.

If not is there any suggestions of how I can make this work together?
My initial thought was just to add the permissions to the table in
question.  I tried to do this from my model file but that does not
work.  I assume it is because the plugin has not defined the tables
before my model is executed.  I would like to avoid modify the plugin
itself as it would be nice to be able to use the latest version
without having to modify it each time.

I tried both the plugin_wiki from the online documentation and the
latest source from the cube2py project just in case this had been
addressed but neither worked.

I appreciate any guidance, this is my first web application and my
first python application so please forgive any obvious things I missed.


[web2py] Re: plugin_wiki crud and auth

2011-10-14 Thread Massimo Di Pierro
You need to create a new group and this this group all crud
permissions (read,write,delete,select) for all plugin_wiki tables.
Than make all users members of the group.

On Oct 14, 8:49 pm, pinwc4 jau...@gmail.com wrote:
 I am attempting to use plugin_wiki with an app I have been developing
 but am encountering a problem.  The application itself uses CRUD and I
 have integrated CRUD with auth by adding the line crud.settings.auth =
 auth in my model.

 Unfortunately when I attempt to use plugin_wiki to edit pages I get a
 not authorized error message.  It will create the page but not let me
 edit.  If I remove the crud.settings.auth = auth line plugin_wiki
 works correctly.  But I need that settings so that auth is enforced on
 my various CRUD forms.

 I was wondering if there is some configuration option or something
 that I am missing that will allow plugin_wiki to work when CRUD is
 integrated with auth?  From a brief look at the code it does not
 appear to be the case.

 If not is there any suggestions of how I can make this work together?
 My initial thought was just to add the permissions to the table in
 question.  I tried to do this from my model file but that does not
 work.  I assume it is because the plugin has not defined the tables
 before my model is executed.  I would like to avoid modify the plugin
 itself as it would be nice to be able to use the latest version
 without having to modify it each time.

 I tried both the plugin_wiki from the online documentation and the
 latest source from the cube2py project just in case this had been
 addressed but neither worked.

 I appreciate any guidance, this is my first web application and my
 first python application so please forgive any obvious things I missed.


[web2py] Re: plugin_wiki crud and auth

2011-10-14 Thread pinwc4
Thank you for such a quick response.

I attempted to do just this from within my model file but got the
error KeyError: 'plugin_wiki_page'.  My guess was that the table is
not defined before my own model runs so I can not set the permissions
there.

So I guess my question at this point is what the best way to set these
permissions would be?  I have created logic in my model file that
checks whether specific groups exist, and if not it creates them and
grants them the expected the permissions.

The reason I did this is that so when I deploy the app in a new
environment all expected groups and permissions are created
automatically instead of manually doing the work.

Is there a better way I should be doing this, preferably in a manner
that will make it simple for others to deploy this without having to
manually set up permissions?

Also thanks for such a great framework.  I was able to go from 0
knowledge to within a few weeks creating a web application for
management of point series where clubs can securely submit their
results.  I reviewed many frameworks before committing to using web2py
and after these past few weeks of work am very happy that I did.

On Oct 14, 8:52 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 You need to create a new group and this this group all crud
 permissions (read,write,delete,select) for all plugin_wiki tables.
 Than make all users members of the group.

 On Oct 14, 8:49 pm, pinwc4 jau...@gmail.com wrote:



Re: [web2py] Does Python Scale?

2011-10-14 Thread Marco Mansilla
El Fri, 14 Oct 2011 18:33:45 -0700
Jonathan Lundell jlund...@pobox.com escribió:

 Makes sense to me. If you care to substitute 'web2py' for 'python'
 you can come to pretty much the same conclusion. The choice of web2py
 influences your architecture, of course, but it neither prevents nor
 guarantees scalability.
 
 
 Does Python Scale?
 Mitch Garnaat
 10/14/11 10:45 AM
 Elastician
 I wonder how many times I've been asked that question over the
 years.  Often, it's not even in the form of a question (Sorry, Mr.
 Trebek) but rather stated emphatically; Python doesn't scale.  This
 can be the start of long, heated discussions involving Global
 Interpreter Locks, interpreters vs. compilers, dynamic vs. static
 typing, etc.  These discussions rarely end satisfactorily for any of
 the parties involved.  And rarely are any opinions changed as a
 result. So, does Python scale?
 
 Well, YouTube is written mostly in Python.  DropBox is written almost
 entirely in Python.  Reddit.  Quora.  Disqus.  FriendFeed.  These are
 huge sites, handling gazillions of hits a day.  They are written in
 Python.  Therefore, Python scales.
 
 Yeah, but what about that web app I wrote that one time.  Hosted on a
 cheapo, oversubscribed VPS, running straight CGI talking to a remote
 MySQL database running in a virtual machine on my Macbook Air.  That
 thing fell over like a drunken sailor when I invited a few of my
 friends to go check it out.  So, yeah.  Forget what I said before.
 Obviously Python doesn't scale.
 
 The truth is, it's the wrong question.  The stuff that allows Dropbox
 to store a million files every 15 minutes has little to do with
 Python just as the things that caused my feeble web app to fail had
 little to do with Python.  It has to do with the overall architecture
 of the application.  How databases are sharded, how loosely or
 tightly components have been coupled, how you monitor, and how you
 react to the data your monitoring is providing you.  And lots of
 other stuff.  But you have to deal with those issues no matter what
 language you write the system in.
 
 No reasonable choice of computer language is going to guarantee your
 success or your failure.  So pick the one you are most productive in
 and focus on properly architecting your app.  That scales.

Fair enough... scalability does not deppend on the language, framework,
tool, etc. On any project scalability deppends on design...
Python/Web2py will be scalable as long as your design itself is, else
it won't.

Marco.


[web2py] web2py powweb

2011-10-14 Thread José Luna Venezuela
Hi I'm traying tu run web2py in www.powweb.com hosting they say the
can run python 2.5 and I found a forum message that says web2py should
run. (http://forum.powweb.com/showthread.php?t=85385)
I tryied tu set it up with the Shared Hosting with mod_python
instruction from chater 11 en the web2py book but it did not work. I
think to be be doing some thing wrong since i haven set up any ip
adress or admin password... ¿Have any one here manage to install
web2py powweb? or can help me doing it?