Re: [web2py] Re: What about a few web2py server vm builds

2011-07-21 Thread Mike Veltman
Thanks, :-)

I probably make it anyway just to play around with it. But then I do not share 
by default.

 There was discussion
 
 http://www.turnkeylinux.org/forum/general/20110107/tklpatch-web2py-framewor
 k
 
 On Jul 20, 8:04 pm, Mike Veltman mike.velt...@gmail.com wrote:
  First I dont know if someone already did it.
  
  I have been playing with suse studio for a while and I thought to build a
  vm/install iso for a base and test web2py server.
  
  So I do some brainstorming
  
  It will be based on a minimal server (opensuse 11.4) install.
  
  I was thinking/brainstorming  to do the following.
  
  1) create a web2py user with a few scripts for dumping and loading
  databases and to start a web2py shell.
  2) create a default mysql database with a defaultdb database thats used
  in the web2py setup.
  3) Place Web2py in /srv/web2py
  4) The installation should not use more then 4 GB
  5) The installation should use LV setup for easy increase of space
  6) Web2py should be autostarting.
  7) iso and vm for installation on usb or in vmware/kvm etc
  
  I was wondering if it would be smart to push web2py into a apache
  webserver or something else. And what other things I should add.
  
  With regards,
  Mike Veltman

With regards,
Mike Veltman




Re: [web2py] Re: What about a few web2py server vm builds

2011-07-21 Thread Mike Veltman

Just to be sure that its clear what I am talking about.

http://susestudio.com

What produces modified opensuse / sles installation disks or vm's to deploy.

So it could generate a full web2py server and it will be about a 300mb 
download as a vmware/kvm image or as a bootable harddisk, life cd or 
installation cd/dvd that automaticly deploys a web2py environment.

Mmmm, it does show that I am a OS man and not a developer ;-)

 There was discussion
 
 http://www.turnkeylinux.org/forum/general/20110107/tklpatch-web2py-framewor
 k
 
 On Jul 20, 8:04 pm, Mike Veltman mike.velt...@gmail.com wrote:
  First I dont know if someone already did it.
  
  I have been playing with suse studio for a while and I thought to build a
  vm/install iso for a base and test web2py server.
  
  So I do some brainstorming
  
  It will be based on a minimal server (opensuse 11.4) install.
  
  I was thinking/brainstorming  to do the following.
  
  1) create a web2py user with a few scripts for dumping and loading
  databases and to start a web2py shell.
  2) create a default mysql database with a defaultdb database thats used
  in the web2py setup.
  3) Place Web2py in /srv/web2py
  4) The installation should not use more then 4 GB
  5) The installation should use LV setup for easy increase of space
  6) Web2py should be autostarting.
  7) iso and vm for installation on usb or in vmware/kvm etc
  
  I was wondering if it would be smart to push web2py into a apache
  webserver or something else. And what other things I should add.
  
  With regards,
  Mike Veltman

With regards,
Mike Veltman




[web2py] Re: typo: http://www.web2py.com/book/default/chapter/11

2011-07-21 Thread cjrh
On Jul 21, 5:33 am, noelrv noe...@gmail.com wrote:
 typo in apt-get below:

Fixed, many thanks.


[web2py] Re: http://www.web2py.com/book/default/chapter/11

2011-07-21 Thread cjrh
On Thursday, 21 July 2011 05:38:47 UTC+2, noelrv wrote:

 URL for ref.83 is broken - http://sial.org/howto/openssl/self-signed


Massimo: what do I do with ref.``openssl``:cite?  Where can I fix the 
target of the cite ref in the book? 


Re: [web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Angelo Compagnucci
Thanks Massimo!

2011/7/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 it  would be much easier to just provide a function row.field.asdate()
 or row.field.astime()

How this could be done? Give me an hint and I'll procede by myself!

Thank you!


Re: [web2py] Re: Simultaneous multi-language system.

2011-07-21 Thread Daniel Gonzalez Zaballos
i'll start with the Anthony suggestion.
I've opened the ticket:
http://code.google.com/p/web2py/issues/detail?id=342

Thank you to everybody

2011/7/21 Massimo Di Pierro massimo.dipie...@gmail.com

 I think for now Anthony's proposal is the way to go. Open a ticket in
 google code and we can think of other options.

 On Jul 20, 5:53 pm, Anthony abasta...@gmail.com wrote:
  I think there are a few possibilities. First, your MultiT function could
  work, but you'd have to use str(T(text)) instead of T(text). The reason
 is
  that T() returns a lazyT object, not the translated string (it isn't
  translated until rendering). You can force the translation by calling the
  lazyT.__str__ method via str(T(text)).
 
  Another option is to define your own T() objects for each language and
 force
  them to use the specific language. For example:
 
  In a model file:
  from gluon.languages import translator
  enT=translator(request)
  enT.force('en-en')
  esT=translator(request)
  esT.force('es-es')
 
  In a view:
  {{=esT('House')}} / {{=enT('House')}}
 
  It would probably be easy to abstract the above by defining a class that
  stores multiple T objects and lets you easily add additional ones.
 
  A third option might be to create a special multi-language translation
 file.
  For example, you could create a file called es-en.py, which could include
  translations such as:
 
  'House': 'Casa / House'
 
  Hope that helps.
 
  Anthony
 
 
 
 
 
 
 
  On Wednesday, July 13, 2011 1:22:23 PM UTC-4, demetrio wrote:
   Hi everyone, i don't know if Simultaneous multi-language system is
   the correct way to say what i need... i'll explain myself.
 
   I'm developing an application that by request of our customer, needs
   to have 2 languages at the same time. For example, if this app were in
   spanish and english, in the navigator should appear something like:
 
   Casa / House
 
   In the view we want to do something like this
 
   {{=T(House, es-es)}} / {{=T(House, en-en)}}
 
   But i don't know if web2py can permit to do this or something like
   that.
 
   I was thinking of writing a function like this:
 
   def MultiT(text,separator= / ):
   T.force(es-es)
   ret_text = T(text)
   T.force(en-en)
   ret_text += separator + T(text)
   return ret_text
 
   But it does not work. Also, do not know how this affects the system
   when updating the language files with the strings to translate (now
   the files are updated automatically when pressing the update
   languages button in admin, and I guess that it would make it on run
   time.
 
   Any sugestions?
 
   Best regards
   Daniel



[web2py] loading image in A(cid=request.cid) within a component

2011-07-21 Thread Sebastian E. Ovide
Hi All,

(probably this is kind of Off Topic)

In a page with a lot of components which have a lot of slow
A(cid=request.cid) links, how do you display a loading  every time that a
link is clicked (within each link) ?  (I'm talking about A links with
cid=request.cid, not about LOAD)

thanks

-- 
Sebastian E. Ovide


Re: [web2py] Re: CAS Auth with other technologies

2011-07-21 Thread António Ramos
I have Novell EDirectory, can i use web2py with Novell auth?


How to to use it?

thank you



2011/7/20 Massimo Di Pierro massimo.dipie...@gmail.com

 The CAS server supports but 1 and 2 but defaults to 2 which is more
 portable. It should work with third party clients out of the box.



 On Jul 19, 8:09 pm, Bruno Bemfica brunobemf...@gmail.com wrote:
  Hi, I'm new on Web2Py and Python, and I have a question: There's any
  way to make apps developed with other technologies (in my case, PHP
  and ASP.NET) authenticate with the web2py CAS server? I need to
  integrate some apps to my company and we have systems made in a lot of
  different technologies. What we need is, for example: Login into the
  web2py app, and if the user click in a link to an ASP.NET or PHP
  application, he doesn't need to login again, and vice-versa.
 
  Thanks!



Re: [web2py] passing dictionary in URL not working. I Get a string

2011-07-21 Thread Manuele Pesenti

On 19/07/2011 19:37, António Ramos wrote:

So what is the best way to pass a dictionary from one page to the other?
can i do session.dictvar=mydictvar?


http://docs.python.org/library/json.html

this is a solution I adopted sometimes... I hope it could be usefull :)

Manuele


[web2py] Re: How can we support standard url in web2py ?

2011-07-21 Thread sabbir
Thanks a lot Jonathan.

I have tested this in app engine also.
It is working fine.

regards,
sabbir

On Jul 20, 11:49 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jul 19, 2011, at 1:05 AM, sabbir wrote:



  A Clickatell call back url can be like this:

 http://www.mysite.com/callback.php?api_id=xxxapiMsgId=xxxcliMsgId=x...

  where I provide the base url:
 http://www.mysite.com/callback.php

  and clickatell will add this part:
  ?
  api_id=xxxapiMsgId=xxxcliMsgId=xxxstatus=xxxtimestamp=xxxto=xxxfrom=xxxcharge=xxx

  is there anyway to support this.

  Thanks and regards,

 Sure. All that will show up in request.vars.


Re: [web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Vasile Ermicioi
I think row.field.date()  already works because row.field is a datetime
object


Re: [web2py] passing dictionary in URL not working. I Get a string

2011-07-21 Thread António Ramos
Thank you a lot.

2011/7/21 Manuele Pesenti manuele.pese...@gmail.com

 On 19/07/2011 19:37, António Ramos wrote:

 So what is the best way to pass a dictionary from one page to the other?
 can i do session.dictvar=mydictvar?


 http://docs.python.org/library/json.html

 this is a solution I adopted sometimes... I hope it could be usefull :)

Manuele



Re: [web2py] Re: Limitation in template system

2011-07-21 Thread Miguel Lopes
No problem be as criticl as you wish.


 Please do not take my critique in a bad way, but be very careful when
 adding blocks of code in your views, I understand the example above
 is just a code sample to illustrate a perceived deficiency in the
 view templating system, but unless you are a PHP developer, this just
 looks ugly, If you have to define variables inside your views, there
 most likely is a problem with the design IMO.  In the general sense,
 variables _control[ler]_ program flow, please place them where they
 belong, even though web2py allows this, and there is even a section
 for this in the book (adding full-fledged python code inside a view
 (html) page), it doesn't mean you must use it.

 There are exceptions as always, you may need to use python code in a
 view, or html code in a controller, there is nothing wrong with
 that, but it should be that, exceptions, please do not turn web2py
 into another PHP-like web development environment and further fuel
 those that want to see us struggle... Thanks.


Re: [web2py] Re: Limitation in template system

2011-07-21 Thread Miguel Lopes
Actually I began by using functions too. But had some problems (can't
remember exactly what), and view functions, even if comprised exclusively of
view code didn't really tick my fancy. I much rather extract those snippets
of HTML to a module or model file exclusively dedicated to html snippets. In
terms of code organization I find that to be a better way of centralizing
templates and such - thus making it much simpler to find them for
maintenance. Actually, I recently been playing with plugin_wiki and found
the same strategy applied. So you just:

{{=ClassOrInstanceFromModels.whateverHTMLBlock()}}

Since I mainly use blocks for sidebars I want to conditionally render two
alternatives suit me:

{{if renderSiderbar:}}
{{=ClassOrInstanceFromModels.whateverHTMLForSideBar()}}
{{pass}}

Which is nice and clean. But I like to have expressed in the main layout
that such sidebar may exist. Hence the using template block:
{{block right_sidebar}}
{{if renderSidebar:  # comes from controller right ;-) }}
 {{=Whatever}}
{{pass}}
{{end}}

Anyway, it is possible the best solution may depend on the situation and
individual preferences.


On Tue, Jul 19, 2011 at 9:26 PM, Bruno Rocha rochacbr...@gmail.com wrote:

 I prefer to work in the old way, used when web2py had no block in views. It
 is very easy and pure Python code.


 {{def myblock():}}
 html code/html code
 {{return}}

 So, in any place of views...

 {{=myblock()}}

 Obviouslly in this way you cannot have {{super}} and other cool things, but
 it is easy to adjust in pure Python, even using classes..




[web2py] Re: http://www.web2py.com/book/default/chapter/11

2011-07-21 Thread Massimo Di Pierro
You cannot but add a note and I will fix it soon.

On Jul 21, 2:12 am, cjrh caleb.hatti...@gmail.com wrote:
 On Thursday, 21 July 2011 05:38:47 UTC+2, noelrv wrote:

  URL for ref.83 is broken -http://sial.org/howto/openssl/self-signed

 Massimo: what do I do with ref.``openssl``:cite?  Where can I fix the
 target of the cite ref in the book?


[web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Massimo Di Pierro
True. I just checked and this already works . :-)

On Jul 21, 4:36 am, Vasile Ermicioi elff...@gmail.com wrote:
 I think row.field.date()  already works because row.field is a datetime
 object


Re: [web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Angelo Compagnucci
Sorry for being retarted!

I have this:

db.define_table('test', Field('comment','string'), Field('data','datetime'))

but the function:

def getcommentsbydate():
   rows = db(db.test).select(db.test.data.comment, db.test.data.date())
   return dict(rows=rows)

throws an exception complaining that the date() method does not exist.

How can I exctract the date without traverse the rows object? I dont
want to use a list comprehension or something else because with
thousands of records is painfull slow (I'm thinking of a radius
accounting table ...)!

I think there is nothing in the DAL that translates to a DATE() sql
function, am I wrong?

Thank you for your suggestion!


[web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Massimo Di Pierro
No that does not work for the reasons discussed above but this does
def getcommentsbydate():
    rows = db(db.test).select(db.test.data.comment, db.test.data)
for row in rows: row.data = row.data.date()
    return dict(rows=rows)

On Jul 21, 8:06 am, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 Sorry for being retarted!

 I have this:

 db.define_table('test', Field('comment','string'), Field('data','datetime'))

 but the function:

 def getcommentsbydate():
    rows = db(db.test).select(db.test.data.comment, db.test.data.date())
    return dict(rows=rows)

 throws an exception complaining that the date() method does not exist.

 How can I exctract the date without traverse the rows object? I dont
 want to use a list comprehension or something else because with
 thousands of records is painfull slow (I'm thinking of a radius
 accounting table ...)!

 I think there is nothing in the DAL that translates to a DATE() sql
 function, am I wrong?

 Thank you for your suggestion!


[web2py] Re: loading image in A(cid=request.cid) within a component

2011-07-21 Thread Anthony
For now, I think you'd have to handle that on your own via Javascript/jQuery 
on the client side. I'll probably submit a patch soon to allow this option 
directly from the A() helper.
 
Anthony

On Thursday, July 21, 2011 4:21:44 AM UTC-4, sebastian wrote:

 Hi All,

 (probably this is kind of Off Topic)

 In a page with a lot of components which have a lot of slow 
 A(cid=request.cid) links, how do you display a loading  every time that a 
 link is clicked (within each link) ?  (I'm talking about A links with 
 cid=request.cid, not about LOAD)

 thanks

 -- 
 Sebastian E. Ovide




[web2py] any windows user want to help with this...

2011-07-21 Thread Massimo Di Pierro
http://code.google.com/p/web2py/issues/detail?id=101#makechanges


Re: [web2py] Re: loading image in A(cid=request.cid) within a component

2011-07-21 Thread Sebastian E. Ovide
that would be great Anthony...!

 are you tracking this new enhancement via google issue list ?

On Thu, Jul 21, 2011 at 3:03 PM, Anthony abasta...@gmail.com wrote:

 For now, I think you'd have to handle that on your own via
 Javascript/jQuery on the client side. I'll probably submit a patch soon to
 allow this option directly from the A() helper.

 Anthony

 On Thursday, July 21, 2011 4:21:44 AM UTC-4, sebastian wrote:

 Hi All,

 (probably this is kind of Off Topic)

 In a page with a lot of components which have a lot of slow
 A(cid=request.cid) links, how do you display a loading  every time that a
 link is clicked (within each link) ?  (I'm talking about A links with
 cid=request.cid, not about LOAD)

 thanks

 --
 Sebastian E. Ovide





-- 
Sebastian E. Ovide


Re: [web2py] Re: loading image in A(cid=request.cid) within a component

2011-07-21 Thread Anthony
On Thursday, July 21, 2011 10:38:32 AM UTC-4, sebastian wrote: 

 that would be great Anthony...!

  are you tracking this new enhancement via google issue list ?

 
No, it's just on my personal to-do list.
Anthony


[web2py] Re: form.errors problem.

2011-07-21 Thread annet
I mailed Pengoworks, this is their reply:

I'm not well versed in Python, but I think you're problem is that the
results from the AJAX call are not in the expected format. By default,
they're expected to be the format:

Sparta|896
Spencer|897
Spencerville|898
Spring Valley|899
Springboro|900
Springfield|901

Where each line is separated by a pipe and each line is delimited with
a line feed. You can change these values lineSeparator and
cellSeparator options. See the docs:

http://www.pengoworks.com/workshop/jquery/autocomplete_docs.txt

However, I'd really recommend migrating to the official jQuery
autocomplete plug-in as it's in active development:

http://jqueryui.com/demos/autocomplete/


Has anyone in the group been using this plug-in? How would I implement
it in the case above?


Kind regards,

Annet.


[web2py] Re: Two fields with autocomplete in a single form fail

2011-07-21 Thread Jim Karsten
This was posted awhile ago but in case anyone else runs into this, the 
problem is the cities and categories fields have both the same name 'name'. 
The AutocompleteWidget *keyword* property gets set to the same value. The 
solution is to provide distinct *keyword* arguments.

Field('city', 
widget=SQLFORM.widgets.autocomplete(request, 
db.cities.name, 
id_field=db.cities.id,
keyword='_autocomplete_cities_%(fieldname)s')),

Field('category', 
widget=SQLFORM.widgets.autocomplete(request, 
db.categories.name http://db.cities.name/, 
id_field=db.categories.id http://db.cities.id/,
keyword='_autocomplete_categories_%(fieldname)s')),

I wonder if the default keyword argument should include the table name.

keyword = '_autocomplete_%(tablename)s_%(fieldname)s'
self.keyword = keyword % dict(tablename=field.tablename, 
fieldname=field.name)


Re: [web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Angelo Compagnucci
Thanks Massimo!

So I must traverse the list at least one time. I dont know how much
time is spent in this operation, but I have a very large number of
records, so I'll test this solution.

Thank you!

2011/7/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 No that does not work for the reasons discussed above but this does
 def getcommentsbydate():
     rows = db(db.test).select(db.test.data.comment, db.test.data)
    for row in rows: row.data = row.data.date()
     return dict(rows=rows)

 On Jul 21, 8:06 am, Angelo Compagnucci angelo.compagnu...@gmail.com
 wrote:
 Sorry for being retarted!

 I have this:

 db.define_table('test', Field('comment','string'), Field('data','datetime'))

 but the function:

 def getcommentsbydate():
    rows = db(db.test).select(db.test.data.comment, db.test.data.date())
    return dict(rows=rows)

 throws an exception complaining that the date() method does not exist.

 How can I exctract the date without traverse the rows object? I dont
 want to use a list comprehension or something else because with
 thousands of records is painfull slow (I'm thinking of a radius
 accounting table ...)!

 I think there is nothing in the DAL that translates to a DATE() sql
 function, am I wrong?

 Thank you for your suggestion!


[web2py] what to put in models besides models?

2011-07-21 Thread António Ramos
hello, i have some startup variables that i defined in db.py

when i go to database administration i get an error.


Traceback (most recent call last):
File gluon/restricted.py, line 192, in restricted
File D:/web2py10/web2py/applications/Lims/views/appadmin.html, line 109,
in module
TypeError: 'dict' object is not callable



the code i added to db.py is this

import pickle
file = open(d:\\Analises.pck, r)
*Analises = pickle.load(file)*
file.close()
file = open(d:\\Unidades.pck, r)
Unidades= pickle.load(file)
file.close()
file = open(d:\\Templates.pck, r)
*Templates = pickle.load(file)*
file.close()
file = open(d:\\Tipo.pck, r)
Tipo = pickle.load(file)
file.close()
*sorted=Analises*

What could be the cause for the error? and again, what can i not declare in
models?

thank you
António


[web2py] Re: what to put in models besides models?

2011-07-21 Thread pbreit
I think in theory you should be able to do that, but do you really want to 
be opening all those files on every page request?

Can you show what code generated the error? My line 109 in appadmin is 
blank.


[web2py] Re: what to put in models besides models?

2011-07-21 Thread Anthony
'sorted' is a Python builtin, and it happens to be called in the 
appadmin.html view. All variables/objects created in the model files are 
available in the view environment as well, so you have redefined the Python 
builtin sorted() function as a dictionary -- *sorted=Analises*. To be safe, 
try to avoid using Python keywords as variable names.
 
Anthony

On Thursday, July 21, 2011 11:53:19 AM UTC-4, Ramos wrote:

 hello, i have some startup variables that i defined in db.py

 when i go to database administration i get an error.


 Traceback (most recent call last):
 File gluon/restricted.py, line 192, in restricted
 File D:/web2py10/web2py/applications/Lims/views/appadmin.html, line 109, 
 in module
 TypeError: 'dict' object is not callable



 the code i added to db.py is this

 import pickle
 file = open(d:\\Analises.pck, r) 
 *Analises = pickle.load(file)*
 file.close()
 file = open(d:\\Unidades.pck, r) 
 Unidades= pickle.load(file)
 file.close()
 file = open(d:\\Templates.pck, r) 
 *Templates = pickle.load(file)*
 file.close()
 file = open(d:\\Tipo.pck, r) 
 Tipo = pickle.load(file)
 file.close()
 *sorted=Analises*

 What could be the cause for the error? and again, what can i not declare in 
 models?

 thank you
 António



Re: [web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread pbreit
I don't know exactly how virtual fields are implemented (if it would prevent 
another run through the result set) but might be another approach.
http://web2py.com/book/default/chapter/06#Virtual-Fields


[web2py] Re: what to put in models besides models?

2011-07-21 Thread Anthony
On Thursday, July 21, 2011 12:01:56 PM UTC-4, pbreit wrote: 

 I think in theory you should be able to do that, but do you really want to 
 be opening all those files on every page request? 

 Can you show what code generated the error? My line 109 in appadmin is 
 blank.

 
Note, in tracebacks for view errors, I believe the line numbers refer to the 
view code _after_ it has been converted to Python, not the original template 
code.
 
Anthony


Re: [web2py] passing dictionary in URL not working. I Get a string

2011-07-21 Thread pbreit
Do you plan to save the data to the DB or elsewhere at some point? I would 
suggest putting it in the DB or stuffing it insto session. The JSON thing is 
more for inter-application communication.

Re: [web2py] Re: what to put in models besides models?

2011-07-21 Thread António Ramos
My traceback gives this in line 109

*  for db in sorted(databases):*
*
*
*
*
*
*

2011/7/21 Anthony abasta...@gmail.com

 On Thursday, July 21, 2011 12:01:56 PM UTC-4, pbreit wrote:

 I think in theory you should be able to do that, but do you really want to
 be opening all those files on every page request?

 Can you show what code generated the error? My line 109 in appadmin is
 blank.


 Note, in tracebacks for view errors, I believe the line numbers refer to
 the view code _after_ it has been converted to Python, not the original
 template code.

 Anthony



[web2py] Re: web2py on github

2011-07-21 Thread luckysmack
because i already know and use git everyday for personal use and at
work. So i know it. in mercurial i kinda know how to pull the updates.
heh. just never really used it much. Not saying it isnt easy to learn
or better/worse. Just that im already using git. if the core was in
git i could so git submodules for the individual applications so all i
would have to do is checkout web2py and update the app and i have
everything. I have no idea how to set that up in mercurial or even how
to mercurial in general.

On Jul 20, 9:12 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jul 20, 2011, at 7:05 PM, luckysmack wrote:



  oh yea? well thats handy. am i able to fork/clone a mercurial repo as
  a git repo?

 Why git, btw? Seems like sticking with hg would be more straightforward.









  On Jul 20, 4:33 am, blackthorne francisco@gmail.com wrote:
  be aware that google code hosting now supports git..

  On Jul 20, 4:44 am, luckysmack luckysm...@gmail.com wrote:

  Well i was going to for the original. But it being so out of date, i
  thought i would just take the mercurial branch and use a tool to
  convert the code and its branches with history to git. that way it is
  exactly what is in the mercurial repos. But doing that i cant fork it.
  i would need to create my own repo. which would mean there would be
  duplicate repos for web2py. is there a way i can for the one on github
  and then merge in the converted mercurial to git copy? since they
  essentially have separate remotes. Anyone know of a way i could do
  this?

  On Jul 19, 8:31 pm, luckysmack luckysm...@gmail.com wrote:

  Letting those users out there know that I will forking the web2py on
  github (which is outdated) and will be updating it as I will need it
  and its easier (for me at least) to keep all my repos in one location.
  Ive already forked it and will be updating it shortly.

 https://github.com/luckysmack/web2py


Re: [web2py] Re: Tiny example on uwsgidecorators+web2py

2011-07-21 Thread Roberto De Ioris

 Hello Roberto,

 I've tried to start web2py has you demonstrated:

  uwsgi --socket :3031 --spooler myspool --master --processes 4 --
 import mytasks --module web2py.wsgihandler

 but I got this error:

 [spooler directory] access(): No such file or directory [uwsgi.c
 line 2994]

 What is wrong?



the spooler directory must exists (it is a security measure)



-- 
Roberto De Ioris
http://unbit.it


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-21 Thread Massimo Di Pierro
I cannot reproduce this. Can anybody else?

On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:
 Ok - added issue ashttp://code.google.com/p/web2py/issues/detail?id=340

 On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:







  Please submit an issue on Google 
  Code:http://code.google.com/p/web2py/issues/list

  On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
   I get this too - a spurious list_records. prepended to the query.
   Latest web2py 1.97.1

   -Andy

   On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
Hi,
Trying to uselinkto, so following example in web2py book
  http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
   first,
to try to understand.

I have copied the example with person and dog tables, in particular in
   def
display_form(): I have

link = URL('list_records')
form = SQLFORM(db.person, record, deletable=True,
                  upload=url,linkto=link, labels = {'dog.owner':This
person's dogs})

as described in the book.

The books says the link generated will be
/test/default/list_records/dog?query=dog.owner%3D5 but in fact the 
link

which appears when I visit /test/default/display_form/1 is
 /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
   i.e.
there is a spurious list.records and a spurious %3D. Not surprisingly 
the

link doesn't work. Can anybody tell me what I am doing wrong?

Thanks.


[web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Massimo Di Pierro
You can just call row.data.date() instead of row.data when you need
the value.


On Jul 21, 10:49 am, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 Thanks Massimo!

 So I must traverse the list at least one time. I dont know how much
 time is spent in this operation, but I have a very large number of
 records, so I'll test this solution.

 Thank you!

 2011/7/21 Massimo Di Pierro massimo.dipie...@gmail.com:







  No that does not work for the reasons discussed above but this does
  def getcommentsbydate():
      rows = db(db.test).select(db.test.data.comment, db.test.data)
     for row in rows: row.data = row.data.date()
      return dict(rows=rows)

  On Jul 21, 8:06 am, Angelo Compagnucci angelo.compagnu...@gmail.com
  wrote:
  Sorry for being retarted!

  I have this:

  db.define_table('test', Field('comment','string'), 
  Field('data','datetime'))

  but the function:

  def getcommentsbydate():
     rows = db(db.test).select(db.test.data.comment, db.test.data.date())
     return dict(rows=rows)

  throws an exception complaining that the date() method does not exist.

  How can I exctract the date without traverse the rows object? I dont
  want to use a list comprehension or something else because with
  thousands of records is painfull slow (I'm thinking of a radius
  accounting table ...)!

  I think there is nothing in the DAL that translates to a DATE() sql
  function, am I wrong?

  Thank you for your suggestion!


[web2py] Re: web2py on github

2011-07-21 Thread Massimo Di Pierro
In the past a user has posted a version of web2py on bitbucket. The
user did not keep it in sync not updated and this has confused some
prospective users.
So please add a clear notice that links the official page and declares
when your code is updated manually (I so assume) and may get out of
sync.

Massimo

On Jul 21, 12:01 pm, luckysmack luckysm...@gmail.com wrote:
 because i already know and use git everyday for personal use and at
 work. So i know it. in mercurial i kinda know how to pull the updates.
 heh. just never really used it much. Not saying it isnt easy to learn
 or better/worse. Just that im already using git. if the core was in
 git i could so git submodules for the individual applications so all i
 would have to do is checkout web2py and update the app and i have
 everything. I have no idea how to set that up in mercurial or even how
 to mercurial in general.

 On Jul 20, 9:12 pm, Jonathan Lundell jlund...@pobox.com wrote:







  On Jul 20, 2011, at 7:05 PM, luckysmack wrote:

   oh yea? well thats handy. am i able to fork/clone a mercurial repo as
   a git repo?

  Why git, btw? Seems like sticking with hg would be more straightforward.

   On Jul 20, 4:33 am, blackthorne francisco@gmail.com wrote:
   be aware that google code hosting now supports git..

   On Jul 20, 4:44 am, luckysmack luckysm...@gmail.com wrote:

   Well i was going to for the original. But it being so out of date, i
   thought i would just take the mercurial branch and use a tool to
   convert the code and its branches with history to git. that way it is
   exactly what is in the mercurial repos. But doing that i cant fork it.
   i would need to create my own repo. which would mean there would be
   duplicate repos for web2py. is there a way i can for the one on github
   and then merge in the converted mercurial to git copy? since they
   essentially have separate remotes. Anyone know of a way i could do
   this?

   On Jul 19, 8:31 pm, luckysmack luckysm...@gmail.com wrote:

   Letting those users out there know that I will forking the web2py on
   github (which is outdated) and will be updating it as I will need it
   and its easier (for me at least) to keep all my repos in one location.
   Ive already forked it and will be updating it shortly.

  https://github.com/luckysmack/web2py


[web2py] GAE deploy only on UNIX Systems?

2011-07-21 Thread António Ramos
why is that?

It does not work on windows?

thank you


[web2py] Re: GAE deploy only on UNIX Systems?

2011-07-21 Thread Massimo Di Pierro
The web interface to GAE deployment yes it only works on Unix systems.
But the fact is whether on windows or not, you still need to download
the google sdk and run dev_appserver.
The web2py deployment page would only save you form typing appcfg.py
deploy web2py and on windows you do not have to do it because you can
use the launcher: https://github.com/makotokw/GoogleAppEngineLauncher.NET

Massimo

On Jul 21, 12:27 pm, António Ramos ramstei...@gmail.com wrote:
 why is that?

 It does not work on windows?

 thank you


[web2py] upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-07-21 Thread zeng
Hey guys,

I'm currently running version 1.95.1 and have 3 application,
AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
authenticate logged in user and it has been working great.

After upgrading 1.96.1 and cross app authentication no longer works,
some debuging lead to:
- web2py.gluon.tools.Auth 
self.environment = current
request = current.request
session = current.session
- web2py.gluon.tools.Auth 

and current is a threading.local() in gluon.globals.py !!!

In the good'o 1.95.1 the session and auth object is retrieved from
global() ,

Question is, why is this changed? this seems to break the backward
compatibility feature of web2py, and what are the recommended
solutions now that global() is no longer used?

Thanks!



[web2py] Unable to install application kpax

2011-07-21 Thread neilrobau2
Following the web2py book, chapter 03 Overview, I try to install KPAX
via the Admin page.
Admin show version 1.97.1.

Under upload and install packed application I provide URL
http://web2py.com/appliances/default/download/app.source.221663266939.tar
as in the book - I get Unable to install apllication kpax.

If I download web2py.app.kpax_cms.w2p, and supply that file in the
Upload a Package field, I get the same message.

I can view the source file applications\admin\controllers\default.py
and see where app_install is called and that error message is
produced, but grep in the web2py and contained directories for
app_install does not show me the definition of app_install.

Any ideas?


[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-07-21 Thread Massimo Di Pierro
This change should not break it. Can you please show us the code that
breaks and we will check what is going on? It is possible that one of
the auth modules has not been patched correctly.

Massimo

On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
 Hey guys,

 I'm currently running version 1.95.1 and have 3 application,
 AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
 authenticate logged in user and it has been working great.

 After upgrading 1.96.1 and cross app authentication no longer works,
 some debuging lead to:
 - web2py.gluon.tools.Auth 
 self.environment = current
 request = current.request
 session = current.session
 - web2py.gluon.tools.Auth 

 and current is a threading.local() in gluon.globals.py !!!

 In the good'o 1.95.1 the session and auth object is retrieved from
 global() ,

 Question is, why is this changed? this seems to break the backward
 compatibility feature of web2py, and what are the recommended
 solutions now that global() is no longer used?

 Thanks!


[web2py] database replication

2011-07-21 Thread Nils Olofsson
Hi,

I see this in the Documentation:

if request.action in read_only_actions:
   db = DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3']))
else:
   db = DAL(shuffle(['mysql://...3','mysql://...4','mysql://...5']))

I'm not sure where exactly I should be using this ?

And does anyone have some sample code as to how it should be used ?

Nils



[web2py] Re: Unable to install application kpax

2011-07-21 Thread Massimo Di Pierro
Did you get admin from stable or trunk? What is the date in your
web2py/VERSION file?

On Jul 21, 11:15 am, neilrobau2 neilro...@gmail.com wrote:
 Following the web2py book, chapter 03 Overview, I try to install KPAX
 via the Admin page.
 Admin show version 1.97.1.

 Under upload and install packed application I provide 
 URLhttp://web2py.com/appliances/default/download/app.source.221663266939...
 as in the book - I get Unable to install apllication kpax.

 If I download web2py.app.kpax_cms.w2p, and supply that file in the
 Upload a Package field, I get the same message.

 I can view the source file applications\admin\controllers\default.py
 and see where app_install is called and that error message is
 produced, but grep in the web2py and contained directories for
 app_install does not show me the definition of app_install.

 Any ideas?


[web2py] Re: database replication

2011-07-21 Thread Massimo Di Pierro
You would only use this if you have a replicated database. I.e. you
are running many database servers synced with each other. For example:
http://en.wikipedia.org/wiki/Multi-master_replication


On Jul 21, 12:44 pm, Nils Olofsson nils.olofs...@gmail.com wrote:
 Hi,

 I see this in the Documentation:

 if request.action in read_only_actions:
    db = DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3']))
 else:
    db = DAL(shuffle(['mysql://...3','mysql://...4','mysql://...5']))

 I'm not sure where exactly I should be using this ?

 And does anyone have some sample code as to how it should be used ?

 Nils


[web2py] Re: Tiny example on uwsgidecorators+web2py

2011-07-21 Thread Tiago Moutinho
How can i create the spoller directory?

thks in advance

On Jul 21, 6:06 pm, Roberto De Ioris robe...@unbit.it wrote:
  Hello Roberto,

  I've tried to start web2py has you demonstrated:

       uwsgi --socket :3031 --spooler myspool --master --processes 4 --
  import mytasks --module web2py.wsgihandler

  but I got this error:

      [spooler directory] access(): No such file or directory [uwsgi.c
  line 2994]

  What is wrong?

 the spooler directory must exists (it is a security measure)

 --
 Roberto De Iorishttp://unbit.it


Re: [web2py] Re: Adding date() and time() to Field object

2011-07-21 Thread Angelo Compagnucci
I'll try to explain better.

I have to exctract some statistics from a radius accounting table that
is generally a really big table.

After exctracting tha data, i pass it to jqplot.com via a json service
to be rendered.

For some graphics, I have to exctract a big amount of dates from
accounting timestamps, and I cannot make it every other way. I have to
exctract a list of dates + something else like counts avarages.

I made a test:

@service.json
def test():
from datetime import datetime
tstart = datetime.now()
rows = dbradius(dbradius.radacct).select(dbradius.radacct.AcctStartTime)
for row in rows: row.AcctStartTime = row.AcctStartTime.date()
tstop = datetime.now()
print tstop - tstart
return rows

@service.json
def test1():
from datetime import datetime
tstart = datetime.now()
rows = dbradius.executesql('''SELECT DATE(AcctStartTime) FROM radacct''')
tstop = datetime.now()
print tstop - tstart
return rows

In my test with 6 records, test1 function completes in around 30
secs. The second one in about 15. As you can see the only visible
difference is traversing the list insted of use sql to excract the
dates.
I think that the problem get worse with many more records. I think
it's wasteful use a for cycle to excrtact dates or time when an sql
construct could be better.

Anyway I think I'm stick with the sql version, thank you to all of you
for the help!

Angelo

2011/7/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 You can just call row.data.date() instead of row.data when you need
 the value.


 On Jul 21, 10:49 am, Angelo Compagnucci angelo.compagnu...@gmail.com
 wrote:
 Thanks Massimo!

 So I must traverse the list at least one time. I dont know how much
 time is spent in this operation, but I have a very large number of
 records, so I'll test this solution.

 Thank you!

 2011/7/21 Massimo Di Pierro massimo.dipie...@gmail.com:







  No that does not work for the reasons discussed above but this does
  def getcommentsbydate():
      rows = db(db.test).select(db.test.data.comment, db.test.data)
     for row in rows: row.data = row.data.date()
      return dict(rows=rows)

  On Jul 21, 8:06 am, Angelo Compagnucci angelo.compagnu...@gmail.com
  wrote:
  Sorry for being retarted!

  I have this:

  db.define_table('test', Field('comment','string'), 
  Field('data','datetime'))

  but the function:

  def getcommentsbydate():
     rows = db(db.test).select(db.test.data.comment, db.test.data.date())
     return dict(rows=rows)

  throws an exception complaining that the date() method does not exist.

  How can I exctract the date without traverse the rows object? I dont
  want to use a list comprehension or something else because with
  thousands of records is painfull slow (I'm thinking of a radius
  accounting table ...)!

  I think there is nothing in the DAL that translates to a DATE() sql
  function, am I wrong?

  Thank you for your suggestion!


[web2py] Re: web2py on github

2011-07-21 Thread pbreit
A lot of code is stored in mercurial so it might be worthwhile to learn it. 
It's quite easy.

If you don't have mercurial installed, install in your preferred way 
(apt-get, easy_install, pip).

Then you only need a couple commands:

To grab Web2py:
$ hg clone https://code.google.com/p/web2py/ web2py

To pull all new changes (but not update your working directory):
$ hg pull

To update your working directory to the latest:
$ hg update

To update your working directory to a specific changeset:
$ hg update [changeset id]

You can use git for your applications, no problem.

This will be *much* easier than trying to sync in git.

Good tutorials:
http://hginit.com
http://mercurial.selenic.com


[web2py] Re: database replication

2011-07-21 Thread Nils Olofsson
Hi Massimo,

I'm testing amazon's RDS and EC2 , 1 master many slaves.

I could not find out where exactly I am suppose to be putting this
code.

Regards,

Nils


On Jul 21, 6:48 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 You would only use this if you have a replicated database. I.e. you
 are running many database servers synced with each other. For 
 example:http://en.wikipedia.org/wiki/Multi-master_replication

 On Jul 21, 12:44 pm, Nils Olofsson nils.olofs...@gmail.com wrote:







  Hi,

  I see this in the Documentation:

  if request.action in read_only_actions:
     db = DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3']))
  else:
     db = DAL(shuffle(['mysql://...3','mysql://...4','mysql://...5']))

  I'm not sure where exactly I should be using this ?

  And does anyone have some sample code as to how it should be used ?

  Nils


Re: [web2py] export data to OOO and Excel

2011-07-21 Thread Dave
This works great, but when i download the file it is missing the extension.  
Is there an easy way to add '.xls' to the file name?

Thanks,
Dave

[web2py] Re: web2py on github

2011-07-21 Thread luckysmack
yea i have it installed already. Im thinking maybe at this point it
might be easier to just use hg. But there is an app out there that
will take a mercurial repos and convert everything into a git repo
including commits and the full history. I tried it at home and it
works great. cant think of the name. ill have to get back to you on
the name. but it worked well.

On Jul 21, 11:25 am, pbreit pbreitenb...@gmail.com wrote:
 A lot of code is stored in mercurial so it might be worthwhile to learn it.
 It's quite easy.

 If you don't have mercurial installed, install in your preferred way
 (apt-get, easy_install, pip).

 Then you only need a couple commands:

 To grab Web2py:
 $ hg clonehttps://code.google.com/p/web2py/web2py

 To pull all new changes (but not update your working directory):
 $ hg pull

 To update your working directory to the latest:
 $ hg update

 To update your working directory to a specific changeset:
 $ hg update [changeset id]

 You can use git for your applications, no problem.

 This will be *much* easier than trying to sync in git.

 Good tutorials:http://hginit.comhttp://mercurial.selenic.com


[web2py] Re: database replication

2011-07-21 Thread Anthony
It would go in your model file -- the same place where you would normally 
define the db connection.
 
Anthony

On Thursday, July 21, 2011 2:29:45 PM UTC-4, Nils Olofsson wrote:

 Hi Massimo, 

 I'm testing amazon's RDS and EC2 , 1 master many slaves. 

 I could not find out where exactly I am suppose to be putting this 
 code. 

 Regards, 

 Nils 


 On Jul 21, 6:48 pm, Massimo Di Pierro massimo@gmail.com 
 wrote: 
  You would only use this if you have a replicated database. I.e. you 
  are running many database servers synced with each other. For example:
 http://en.wikipedia.org/wiki/Multi-master_replication 
  
  On Jul 21, 12:44 pm, Nils Olofsson nils.o...@gmail.com wrote: 
  
  
  
  
  
  
  
   Hi, 
  
   I see this in the Documentation: 
  
   if request.action in read_only_actions: 
  db = DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3'])) 
   else: 
  db = DAL(shuffle(['mysql://...3','mysql://...4','mysql://...5'])) 
  
   I'm not sure where exactly I should be using this ? 
  
   And does anyone have some sample code as to how it should be used ? 
  
   Nils



[web2py] Re: http://www.web2py.com/book/default/chapter/11

2011-07-21 Thread noelrv


Following reference URL is probably a better and more stable link.

http://www.tc.umn.edu/~brams006/selfsign.html

Noel


On Jul 21, 11:33 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 You cannot but add a note and I will fix it soon.

 On Jul 21, 2:12 am, cjrh caleb.hatti...@gmail.com wrote:







  On Thursday, 21 July 2011 05:38:47 UTC+2, noelrv wrote:

   URL for ref.83 is broken -http://sial.org/howto/openssl/self-signed

  Massimo: what do I do with ref.``openssl``:cite?  Where can I fix the
  target of the cite ref in the book?


[web2py] Passing None to controller functions with urllib.urlencode

2011-07-21 Thread Michael Ellis
In a data acquisition system, I need to handle reports for sensor
channels that may not have anything connected to them.  The relevant
fields in my table definition look like:

Field('f_ch1_value_double', type = 'double', default = None,
  label = T(CH1)),
Field('f_ch2_value_double', type = 'double', default = None,
  label = T(CH2)),
Field('f_ch3_value_double', type = 'double', default = None,
   label = T(CH3)),
Field('f_ch4_value_double', type = 'double', default = None,
   label = T(CH4)),
Field('f_ch5_value_double', type = 'double', default = None,
   label = T(CH5)),
Field('f_ch6_value_double', type = 'double', default = None,
   label = T(CH6)),

and I have a function that starts like this:

@service.json
def v2_data_insert(timestamp, sensorid,
   ch1=None, ch2=None, ch3=None, ch4=None, ch5=None,
ch6=None,
   flowrate=None, flowtemp=None, erate=None,
   chargev=None, battv=None, sensorv=None):

db.t_v2_data[0] = dict(f_timestamp_datetime = timestamp,
   f_sensor_reference = sensorid,
   f_ch1_value_double = ch1,
   f_ch2_value_double = ch2,
   f_ch3_value_double = ch3,
   f_ch4_value_double = ch4,
   f_ch5_value_double = ch5,
   f_ch6_value_double = ch6,
   f_flow_rate_double = flowrate,
   f_flow_temp_double = flowtemp,
   f_energy_rate_double = erate,
   f_battery_charger_double = chargev,
   f_battery_volts_double = battv,
   f_sensor_volts_double = sensorv)

Passing None to any of the channel arguments, e.g. ch1 = None, is
raising

ValueError: could not convert string to float: None

on the insert call even though null is allowed by the field
definition.  I suspect this must be an issue with the way
urllib.urlencode() the dictionary containing the channel values before
the data is posted to my controller.

The process that sends the data is doing the following:

encodeddata = urllib.urlencode(data)
response = urllib2.urlopen(server + url, encodeddata)

where data is the dictionary that maps to the keyword arguments of
v2_data_insert().

I can hack around this issue by testing for 'None' as a string value
in the controller, but I'd be grateful for a more elegant soution.

Thanks,
Mike


Re: [web2py] export data to OOO and Excel

2011-07-21 Thread Joaquin Orbe
On Thu, Jul 21, 2011 at 3:40 PM, Dave davidramsayreinh...@gmail.com wrote:
 This works great, but when i download the file it is missing the extension.
 Is there an easy way to add '.xls' to the file name?

 Thanks,
 Dave

Hi Dave,
how do you download the file? This method is an action in one controller, ie:

http://127.0.0.1:8000/myapp/printer/excel_report

and the file is downloaded as XLS.

Joaco.


[web2py] Re: database replication

2011-07-21 Thread Nils Olofsson
Hi,

I did this but i got :

Traceback (most recent call last):
  File /var/www/web2py/gluon/restricted.py, line 192, in restricted
exec ccode in environment
  File /var/www/web2py/applications/Event/models/db.py, line 18, in
module
if request.action in read_only_actions:
NameError: name 'read_only_actions' is not defined

type 'exceptions.NameError'(name 'read_only_actions' is not defined)

This error is the reason i asked where it should go.

Maybe some one could shed some light on it ?

Regards,
Nils


On Jul 21, 7:44 pm, Anthony abasta...@gmail.com wrote:
 It would go in your model file -- the same place where you would normally
 define the db connection.

 Anthony







 On Thursday, July 21, 2011 2:29:45 PM UTC-4, Nils Olofsson wrote:
  Hi Massimo,

  I'm testing amazon's RDS and EC2 , 1 master many slaves.

  I could not find out where exactly I am suppose to be putting this
  code.

  Regards,

  Nils

  On Jul 21, 6:48 pm, Massimo Di Pierro massimo@gmail.com
  wrote:
   You would only use this if you have a replicated database. I.e. you
   are running many database servers synced with each other. For example:
 http://en.wikipedia.org/wiki/Multi-master_replication

   On Jul 21, 12:44 pm, Nils Olofsson nils.o...@gmail.com wrote:

Hi,

I see this in the Documentation:

if request.action in read_only_actions:
   db = DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3']))
else:
   db = DAL(shuffle(['mysql://...3','mysql://...4','mysql://...5']))

I'm not sure where exactly I should be using this ?

And does anyone have some sample code as to how it should be used ?

Nils


[web2py] Re: database replication

2011-07-21 Thread Anthony
That's just some (incomplete) example code. You have to define 
'read_only_actions' yourself. In that example, it would be a list functions 
that only need to read (but not write) the database and can therefore be 
given access to one of the slave databases.
 
Actually, it looks like the code has an error -- it should say 
request.function, not request.action -- I'll make the change.
 
Anthony

On Thursday, July 21, 2011 3:54:20 PM UTC-4, Nils Olofsson wrote:

 Hi, 

 I did this but i got : 

 Traceback (most recent call last): 
   File /var/www/web2py/gluon/restricted.py, line 192, in restricted 
 exec ccode in environment 
   File /var/www/web2py/applications/Event/models/db.py, line 18, in 
 module 
 if request.action in read_only_actions: 
 NameError: name 'read_only_actions' is not defined 

 type 'exceptions.NameError'(name 'read_only_actions' is not defined) 

 This error is the reason i asked where it should go. 

 Maybe some one could shed some light on it ? 

 Regards, 
 Nils 


 On Jul 21, 7:44 pm, Anthony abas...@gmail.com wrote: 
  It would go in your model file -- the same place where you would normally 

  define the db connection. 
  
  Anthony 
  
  
  
  
  
  
  
  On Thursday, July 21, 2011 2:29:45 PM UTC-4, Nils Olofsson wrote: 
   Hi Massimo, 
  
   I'm testing amazon's RDS and EC2 , 1 master many slaves. 
  
   I could not find out where exactly I am suppose to be putting this 
   code. 
  
   Regards, 
  
   Nils 
  
   On Jul 21, 6:48 pm, Massimo Di Pierro massi...@gmail.com 
   wrote: 
You would only use this if you have a replicated database. I.e. you 
are running many database servers synced with each other. For 
 example: 
  http://en.wikipedia.org/wiki/Multi-master_replication 
  
On Jul 21, 12:44 pm, Nils Olofsson nils...@gmail.com wrote: 
  
 Hi, 
  
 I see this in the Documentation: 
  
 if request.action in read_only_actions: 
db = 
 DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3'])) 
 else: 
db = 
 DAL(shuffle(['mysql://...3','mysql://...4','mysql://...5'])) 
  
 I'm not sure where exactly I should be using this ? 
  
 And does anyone have some sample code as to how it should be used ? 

  
 Nils



[web2py] In app wizard where are the themes and plug ins?

2011-07-21 Thread António Ramos
The subject says it all


Where are they?

I saw a video from Massimo and in the wizard i saw a lot of themes and plug
ins.


thank you
António


[web2py] web2py vs Drupal

2011-07-21 Thread elffikk
hi,

soon I will have a conversation with a client and it is possible that
we will discuss this thing too,
I have good experience with php, but not with Drupal,
if some of you have some experience and migrated to web2py please
share that

thank you


[web2py] Re: In app wizard where are the themes and plug ins?

2011-07-21 Thread Anthony
It's supposed to pull those lists from 
http://www.web2py.com/layouts/default/layouts.json and 
http://www.web2py.com/plugins/default/plugins.json. Those URLs currently 
return an invalid view error, so I'm guessing the code was relying on the 
generic.json view, which is now disabled by default. If that's the case, 
Massimo will have to enable generic.json for those functions in those apps.
 
Anthony

On Thursday, July 21, 2011 4:53:30 PM UTC-4, Ramos wrote:

 The subject says it all


 Where are they?

 I saw a video from Massimo and in the wizard i saw a lot of themes and plug 
 ins.


 thank you
 António



Re: [web2py] web2py vs Drupal

2011-07-21 Thread Bruno Rocha
Absolutelly different projects.

Drupal is a cms and web2py is a framework.

We do not have. Yet. A complete cms like Drupal.

http://zerp.ly/rochacbruno
Em 21/07/2011 17:58, elffikk elff...@gmail.com escreveu:
 hi,

 soon I will have a conversation with a client and it is possible that
 we will discuss this thing too,
 I have good experience with php, but not with Drupal,
 if some of you have some experience and migrated to web2py please
 share that

 thank you


[web2py] web2py Talks - spreading the love

2011-07-21 Thread Francisco Costa
Hi,
I would love to do a presentation about web2py at Codebits 2011
(http://codebits.eu)

Is there any central repository with web2py presentations/videos that
I'm not aware of?

I'm going to perform a standard search (slideshare, vimeo, etc) but if
you guys have more data related to web2py I would love to take a look.

If you got some benchmarks that would be great because this is a very
technical conference.

I think it is good idea to have something like that for spreading the
love...


[web2py] Re: export data to OOO and Excel

2011-07-21 Thread Dave
I added it to default.py controller, so it is working as an action
there.

When i go to that URL  (.../default/excel_report), the file downloads
as excel_report with no extension.  I am testing using Mac OS, so
not sure if that matters.  The file is fine.  When i rename it with
the .xls extension it opens in my spreadsheet application.

Thanks,
Dave


On Jul 21, 1:51 pm, Joaquin Orbe joaquino...@gmail.com wrote:
 On Thu, Jul 21, 2011 at 3:40 PM, Dave davidramsayreinh...@gmail.com wrote:
  This works great, but when i download the file it is missing the extension.
  Is there an easy way to add '.xls' to the file name?

  Thanks,
  Dave

 Hi Dave,
 how do you download the file? This method is an action in one controller, ie:

 http://127.0.0.1:8000/myapp/printer/excel_report

 and the file is downloaded as XLS.

 Joaco.


[web2py] Integrity errors DAL - insert, bulk insert

2011-07-21 Thread nick name
Documenting for others a behaviour I found surprising:

Database insert for one record eats integrity errors and returns a None key 
for the inserted record. It doesn't tell you what the integrity problem is 
(I guess it is ok for code, because there is no reasonable to describe the 
integrity problem -- but I would appreciate some way to log that for 
debugging).

Doing a bulk_insert is simply a loop over single insert; that is, if you 
bulk_insert 10 records and 5 violate integrity, you will have 5 inserted, 5 
not inserted, and the return will be a list of 5 new primary keys and 5 None 
values. 

I would have expected bulk_insert to either succeed or fail completely, like 
it usually does in SQL. (This behaviour could be emulated by issuing a db 
rollback if the return from bulk_insert() contains a Non value).

Furthermore, I would have expected it to use a multiple-insert syntax if 
supported by the back end  -- e.g. in MySQL, you can do 

INSERT INTO *tbl_name* (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

which is generally faster than multiple individual inserts. However, because 
of the way bulk_insert is implemented by default, it is impossible for a 
specific adapter to implement this, because in that case the bulk_insert *
does* become an all-or-nothing.

I'm a little confused about this, and am therefore avoiding bulk_insert 
completely.



[web2py] OS X Lion Python

2011-07-21 Thread Jonathan Lundell
Ned Deily posted the following on Pythonmac-SIG just now. It's probably of 
interest to many of us on this list. Note that Lion ships with *three* versions 
of Python installed.


 Here's my take on things after installing and some quick testing with 
 10.7 Lion:
 
 - If you were satisfied with using the Apple-supplied Pythons in 
 previous OS X releases, you'll probably be satisfied with the 2.7, 2.6, 
 or 2.5 system Pythons in 10.7.
 
 - You should not rely on the Apple-suppled Pythons if you want to use 
 IDLE.
   http://www.python.org/download/mac/tcltk/
 
 - If you prefer to use more recent Pythons and have been satisfied with 
 python.org OS X installers, use the most recent 3.2.1 or 2.7.2 
 64-bit/32-bit (x86-64 / i386) installers for Mac OS X:
   http://www.python.org/download/
 As with 10.6, if you are planning to use IDLE or Tkinter with these 
 installers, you should also install the most recent ActiveTcl 8.5 if you 
 can (check the license terms):
   http://www.activestate.com/activetcl/downloads
 
 - If you need to install any Python packages that build C extension 
 modules, you'll need to install Xcode for Lion (currently 4.1 and now 
 available for free download through the Mac App store).
 
 - The traditional python.org 32-bit-only 10.3+ (i386/PPC) Pythons can be 
 installed on 10.7 and do work in general; however, it is not practical 
 to build C extension modules on 10.7 that will work with them (since 
 Xcode 4 no longer includes the 10.4u SDK nor gcc-4.0).  Unless you have 
 specialized needs and know what you are doing, you should avoid using 
 the traditional 32-bit-only installers on 10.7 in favor of either using 
 the 64-bit/32-bit variants, using versions from a different distributor, 
 or building your own.  As on 10.6, if you need to run in 32-bit mode, 
 you can use python3.2-32 or python2.7-32 with the 64-bit/32-bit 
 variants.
 
 
 
 Random details:
 
 Apple ships 10.7 with 3 system Pythons:
 
 /usr/bin/python2.7
 Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
 [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on 
 darwin
 /usr/bin/python2.6
 Python 2.6.6 (r266:84292, Jun 16 2011, 16:59:16) 
 [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on 
 darwin
 /usr/bin/python2.5
 Python 2.5.5 (r255:77872, Jun 16 2011, 16:58:16) 
 [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on 
 darwin
 
 The 2.7 and 2.6 instances are 2-way Intel universal binaries (x86_64 and 
 i386); the 2.5 one is i386 (32-bit) only.  The 2.7 version, at least, 
 comes pre-installed with various 3rd-party packages, like setupttols, 
 PyObjC, py2app, numpy, twisted, Zope, etc, similar to what was shipped 
 for 2.6 in 10.6.  (I didn't look at the 2.6 and 2.5 frameworks.)  The 
 downside of shipping these packages is that some, including Python 
 itself, are not the latest versions.
 
 Tcl/Tk:  As in 10.6, Apple ships two versions of Tcl/Tk: a Cocoa Tk 8.5 
 and the venerable Carbon Tk 8.4.  The 8.5 version has been updated to 
 8.5.9.  The Tkinters in all three Apple-supplied Pythons are linked with 
 8.5.  The good news is that the updated 8.5 is not the disaster that the 
 10.6 version was.  The bad news is that it is missing at least one fix 
 to Tk from earlier this year:
 Cocoa Tk crashes when typing a composite character into a text field 
 (http://sourceforge.net/tracker/index.php?func=detailaid=2907388group_i
 d=12997atid=112997).  The fix for this crash is incorporated into the 
 most recent ActiveTcl 8.5 releases for OS X.  However, the system 
 Pythons will not attempt to dynamically link to user-installed Tcl/Tk 
 frameworks in /Library (where the ActiveState frameowrks are installed), 
 unlike the Pythons installed by python.org installers.  So, out of the 
 box, the IDLE versions that come with the system Pythons are vulnerable 
 to this.  But at least they aren't totally unusable as was the case with 
 10.6.  And I suppose if there are enough bug reports this fix might get 
 applied in a future 10.7 update.
 
 Although it's not practical to build packages with C extension modules 
 on 10.7 for the traditional 32-bit-only python.org Pythons (as explained 
 above), it is possible to build such packages with the same Python 
 installed on a 10.6, 10.5, or even 10.4 system, create a Distutils bdist 
 or setuptools/Distribute bdist-egg and then install the binary 
 distribution on the 10.7 system.  I would avoid going down that path if 
 possible, unless it is needed as a temporary transition phase.
 
 -- 
 Ned Deily,
 n...@acm.org
 
 ___
 Pythonmac-SIG maillist  -  pythonmac-...@python.org
 http://mail.python.org/mailman/listinfo/pythonmac-sig
 unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[web2py] Re: OS X Lion Python

2011-07-21 Thread pbreit
I installed Lion + Xcode 4.1 and things have been OK so far.

I had a lot of trouble before installing PIL and lxml but they both 
installed without a hitch on Lion.


[web2py] Re: export data to OOO and Excel

2011-07-21 Thread Dave
I added these two lines and its working now!

response.headers['Content-Disposition']='attachment;
filename=test.xls'
response.headers['Content-Title']='test.xls'


Dave

On Jul 21, 4:48 pm, Dave davidramsayreinh...@gmail.com wrote:
 I added it to default.py controller, so it is working as an action
 there.

 When i go to that URL  (.../default/excel_report), the file downloads
 as excel_report with no extension.  I am testing using Mac OS, so
 not sure if that matters.  The file is fine.  When i rename it with
 the .xls extension it opens in my spreadsheet application.

 Thanks,
 Dave

 On Jul 21, 1:51 pm, Joaquin Orbe joaquino...@gmail.com wrote:







  On Thu, Jul 21, 2011 at 3:40 PM, Dave davidramsayreinh...@gmail.com wrote:
   This works great, but when i download the file it is missing the 
   extension.
   Is there an easy way to add '.xls' to the file name?

   Thanks,
   Dave

  Hi Dave,
  how do you download the file? This method is an action in one controller, 
  ie:

 http://127.0.0.1:8000/myapp/printer/excel_report

  and the file is downloaded as XLS.

  Joaco.


[web2py] virtual fields multiple execution

2011-07-21 Thread howesc
hi all,

can someone take a peek 
at http://code.google.com/p/web2py/issues/detail?id=345 and tell me if that 
sounds reasonable?  i made the patch and it seems to help me, but i would 
like some validation that this won't break things more.

problem is that the list of virtual tables ends up with duplicates in it 
(one per row in the result set) and then setvirtualfields() is called many 
times, and on GAE that causes my request to be terminated for taking too 
long to complete.

thanks for the sanity check!

christian


[web2py] Re: Unable to install application kpax

2011-07-21 Thread neilrobau2
VERSION says Version 1.97.1 (2011-06-26 19:25:44). Downloaded as
Current (for everybody)
Version 1.97.1 (2011-06-26 19:25:44), Windows version.

On Jul 22, 3:45 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Did you get admin from stable or trunk? What is the date in your
 web2py/VERSION file?

 On Jul 21, 11:15 am, neilrobau2 neilro...@gmail.com wrote:







  Following the web2py book, chapter 03 Overview, I try to install KPAX
  via the Admin page.
  Admin show version 1.97.1.

  Under upload and install packed application I provide 
  URLhttp://web2py.com/appliances/default/download/app.source.221663266939...
  as in the book - I get Unable to install apllication kpax.

  If I download web2py.app.kpax_cms.w2p, and supply that file in the
  Upload a Package field, I get the same message.

  I can view the source file applications\admin\controllers\default.py
  and see where app_install is called and that error message is
  produced, but grep in the web2py and contained directories for
  app_install does not show me the definition of app_install.

  Any ideas?


[web2py] Re: AttributeError: 'thread._local' with wsgiref.simple_server or similar

2011-07-21 Thread Christopher F
Well, I solved it somehow.

If I import web2py.gluon.main and use web2py.gluon.main.wsgibase, exec 
ccode in environment will reimport web2py and web2py.gluon.globals.current 
will be created within the environment each time. If I import gluon.main and 
use gluon.main.wsgibase, current will be reused from outside the 
environment and the application works. 

However, during debugging with the built-in Rocket server, it seems like 
only one gluon.globals.current is used for all the threads. When a 
breakpoint is set in Auth.__init__(), current seems to have the same id() 
in all the threads. I thought it current should be different objects for 
each thread. I'm using Eclipse for the debugging and maybe it's being wrong. 
Still, I'm confused at the Python environment within environment and all the 
module namespace importing stuff. Maybe someone can explain what is going on 
and how I solved it?

Otherwise, web2py is working now.


[web2py] Re: No CallBack (Onaccept) When using facebook or Twitter Connect for loging.

2011-07-21 Thread howesc
i use this:

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

together with the custom facebook and twitter classes, and an extension to 
the web2py auth module i can get the best of both worlds.

cfh


[web2py] Re: any windows user want to help with this...

2011-07-21 Thread Brian M
Massimo,

What specifically are you looking for? All that is needed is to use the 
already included setup_exe.py  The new setup_exe.py from issue 
224http://code.google.com/p/web2py/issues/detail?id=224 which 
was merged in April (rev 
216a13ba21a1http://code.google.com/p/web2py/source/detail?spec=svn977fba3e16687dd91f150d039a4ef03eec467e68r=216a13ba21a128f8ba0eb58b35c00a1655fd462a)
 
should take care of doing the compile  bundling the default apps (btw 
setup_exe.conf doesn't appear to be in the latest stable source release tho 
it is in the google repo).  Do you just need somebody to run the build 
script one a windows machine for you?  I can certainly do that if needed.

As far as licensing issues I'm no expert.  pyODBC is under the MIT license. 
 pymysql is also under the MIT license and web2py is already including it, 
so I'd think* that we're OK.

~Brian

*I am not a lawyer nor have I every played on one TV.


[web2py] Re: Localising decimal values in form fields

2011-07-21 Thread JanoPales
Hi,
I'm getting same error (gluaon/validators.py, line 807), version
1.97.1. Debugger says this.dot is type lazyT, so I made a test and
added str(). Line now looks:

def formatter(self, value):
return str(value).replace('.',str(self.dot))

also line 793

try:
if isinstance(value,decimal.Decimal):
v = value
else:
v =
decimal.Decimal(str(value).replace(str(self.dot),'.'))

and it seems to work, but I'm new to Python and not sure it is
correct.

Sorry for my english
Jano


On 30. Jún, 11:19 h., tomtom5 tomt...@chello.at wrote:
 Thanks for this hint, but that doesn't seem to work.
 If I apply this to the field in either model or controller, i get
 following error:
   
   File gluon/sqlhtml.py, line 782, in __init__
   File gluon/dal.py, line 5247, in formatter
   File gluon/validators.py, line 807, in formatter
 TypeError: expected a character buffer object

 If I use fixed value (eg .. requires=IS_DECIMAL_IN_RANGE(dot=,) ...)
 the conversion seems to work.

 On 29 Jun., 17:46, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  IS_DECIMAL_IN_RANGE and IS_FLOAT take a an attribute called dot=.
  which you can internationalize

  IS_DECIMAL_IN_RANGE(dot=T(.))

  On Jun 29, 5:39 am, tomtom5 tomt...@chello.at wrote:

   I'm currently diving into web2py and got a problemlocalisinginput/
   output ofDecimal/Doubleformfields according to the users (browsers)
   locale. I understand the mechanism of internationalising messages with
   T(..), but that doesn't seem to help me further. What I need is, that
   for example a german user may input adecimalvalue as 123.456,78
   while an american user will use 123 456.78 as input/output format. I
   found methods to define thedecimalseparator char in the constructor
   of the IS_DECIMAL_IN_RANGE validator, but this is very rudimentary and
   will not be user-locale aware. Is there a way to solve the problem out
   of the box or should I create new validators or widgets for such a
   task?
   Thanks for advise


[web2py] Re: MongoDb and web2py

2011-07-21 Thread Karthik
Hi Massimo,

Thanks for this. Do you know if it will hold up in a high performance
situation though?
As in, if multiple connections originate at the same time, won't there
be a queue?
Is it possible to simulate the connection pooling mechanism in
web2py's DAL?

Thanks,
Karthik

On Jul 31 2010, 4:13 am, mdipierro mdipie...@cs.depaul.edu wrote:
 how about this? (None below means cache forever)

 def make_connection():
     from pymongo import Connection
     connection = Connection('localhost', 27017)
     return connection

 connection = cache.ram('mongodb',make_connection,None)

 On Jul 31, 3:11 am, David Marko dma...@tiscali.cz wrote:







  Hi Massimo, can you give ua a hint how to impelement persistent
  connection in web2py for pyMongo? PyMongo requires database connection
  and to use it efficiently the connection has to be persistent and
  shared among requests like a connection pool for database connections
  as DAL has. But how to do it in web2py?

  e.g.
  from pymongo import Connection
  connection = Connection('localhost', 27017)

  ### how to keep this connection object?

  David

  On 31 čnc, 09:57, mdipierro mdipie...@cs.depaul.edu wrote:

   yes. Just set dbio=False in forms and do your own mymongo IO after
   accepts:

   On Jul 30, 11:18 am, Amit Ambardekar amit...@gmail.com wrote:

I want to use web2py with pymongo.
I don't need ORM or or anything. I just want to connect use pymongo
from Web2Py.
How can I use it inside web2py. I need it for high performance use.

Amit


[web2py] Re: Passing None to controller functions with urllib.urlencode

2011-07-21 Thread Massimo Di Pierro
The problem is that get vars userd to pass json arguments are always
strings.

On Jul 21, 2:38 pm, Michael Ellis michael.f.el...@gmail.com wrote:
 In a data acquisition system, I need to handle reports for sensor
 channels that may not have anything connected to them.  The relevant
 fields in my table definition look like:

     Field('f_ch1_value_double', type = 'double', default = None,
           label = T(CH1)),
     Field('f_ch2_value_double', type = 'double', default = None,
           label = T(CH2)),
     Field('f_ch3_value_double', type = 'double', default = None,
            label = T(CH3)),
     Field('f_ch4_value_double', type = 'double', default = None,
            label = T(CH4)),
     Field('f_ch5_value_double', type = 'double', default = None,
            label = T(CH5)),
     Field('f_ch6_value_double', type = 'double', default = None,
            label = T(CH6)),

 and I have a function that starts like this:

 @service.json
 def v2_data_insert(timestamp, sensorid,
                    ch1=None, ch2=None, ch3=None, ch4=None, ch5=None,
 ch6=None,
                    flowrate=None, flowtemp=None, erate=None,
                    chargev=None, battv=None, sensorv=None):

     db.t_v2_data[0] = dict(f_timestamp_datetime = timestamp,
                            f_sensor_reference = sensorid,
                            f_ch1_value_double = ch1,
                            f_ch2_value_double = ch2,
                            f_ch3_value_double = ch3,
                            f_ch4_value_double = ch4,
                            f_ch5_value_double = ch5,
                            f_ch6_value_double = ch6,
                            f_flow_rate_double = flowrate,
                            f_flow_temp_double = flowtemp,
                            f_energy_rate_double = erate,
                            f_battery_charger_double = chargev,
                            f_battery_volts_double = battv,
                            f_sensor_volts_double = sensorv)

 Passing None to any of the channel arguments, e.g. ch1 = None, is
 raising

 ValueError: could not convert string to float: None

 on the insert call even though null is allowed by the field
 definition.  I suspect this must be an issue with the way
 urllib.urlencode() the dictionary containing the channel values before
 the data is posted to my controller.

 The process that sends the data is doing the following:

     encodeddata = urllib.urlencode(data)
     response = urllib2.urlopen(server + url, encodeddata)

 where data is the dictionary that maps to the keyword arguments of
 v2_data_insert().

 I can hack around this issue by testing for 'None' as a string value
 in the controller, but I'd be grateful for a more elegant soution.

 Thanks,
 Mike


[web2py] deploying web2py app on gae

2011-07-21 Thread amr negm
i deployed my application using the gae sdk. when I browse the app it
just shows hello world message. why?


Re: [web2py] Re: Tiny example on uwsgidecorators+web2py

2011-07-21 Thread Roberto De Ioris

 How can i create the spoller directory?



mkdir myspool

It is a normal, empty directory




 thks in advance

 On Jul 21, 6:06 pm, Roberto De Ioris robe...@unbit.it wrote:
  Hello Roberto,

  I've tried to start web2py has you demonstrated:

       uwsgi --socket :3031 --spooler myspool --master --processes 4 --
  import mytasks --module web2py.wsgihandler

  but I got this error:

      [spooler directory] access(): No such file or directory [uwsgi.c
  line 2994]

  What is wrong?

 the spooler directory must exists (it is a security measure)

 --
 Roberto De Iorishttp://unbit.it



-- 
Roberto De Ioris
http://unbit.it