Re: [web2py] returning from a controller and escaping the html...

2011-01-20 Thread rochacbruno
def return_dis():
   return XML(hi there dude, escape=True|False)


Em 20/01/2011, às 06:27, encompass encomp...@gmail.com escreveu:

 I have a control function as follows:
 
 def return_dis():
return hi there dude
 
 Of course it returns it just fine except that I would like to escape
 the   and any other html stuff.
 Is there something special in web2py for that or should I make my own
 method for that?
 I could make a blank page but I figure there has to be a better way
 then just making a blank .html file.
 
 BR,
 Jason Brower


Re: [web2py] Re: Long-running controllers

2011-01-20 Thread António Ramos
Please add to the book your suggestion.

2011/1/19 Massimo Di Pierro massimo.dipie...@gmail.com

 Your code does not block the server. Only blocks the session
 associated to your browser to guarantee integrity of the data in your
 session. If you know that the block function takes time and it does
 not need to save session, you can do:

 def blockme():
session.forget()
 import time
time.sleep(30)

 def sayjunk():
return htmlheadtitleJunk/title/headbodyjunk/body/
 html



 On Jan 18, 8:50 pm, ae ae88...@gmail.com wrote:
  On Jan 18, 9:17 pm, Jonathan Lundell jlund...@pobox.com wrote:
 
 
 
 
 
 
 
 
 
   On Jan 18, 2011, at 5:41 PM, ae wrote:
 
On Jan 18, 11:22 am, Jonathan Lundell jlund...@pobox.com wrote:
 
When you say anyone associated with the thread, do you mean other
 requests using some shared, locked resource (like the session)? Or something
 else?
 
Browser sessions seem to get associated to a thread.  As long as that
thread is busy the user won't (and anyone else who's session is
assocated to that thread won't) be able to do anything else.  This
mostly seems like a security precaution and is good.
 
   Each request runs in its own thread. Users don't share sessions, so
 session serialization won't block other users. Database serialization could,
 though.
 
   On the whole, I think you're better off using JavaScript to make this
 kind of thing asynchronous. Better user experience, too.
 
  Yeah.  I didn't ever think that users share sessions, but I believe
  that a browser cookie is set and that cookie is associated to a
  thread. (one thread, many sessions).  When a thread is busy for a
  while, all users associated to that thread will block on that thread.
  (note that I'm using an old version that uses CherryPy, but I would be
  surprised if it's different with Rocket)
 
  Try creating a file like this default.py:
 
  def blockme():
  import time
  time.sleep(30)
 
  def sayjunk():
  return htmlheadtitleJunk/title/headbodyjunk/body/
  html
 
  Then hit the blockme function from your browser and before the end of
  that 30 seconds see if you can access sayjunk.
 
  I have a few controllers that occasionally take longer than expected.
  When that happens I have reports of multiple users not being able to
  access the application for until they 1) wait a while or 2) restart
  their browser.
 
  Again, I just wanted to see if anyone had thought of a simpler
  solution than I did.
 
  --Todd



[web2py] Checkboxes(multiple) and editing data

2011-01-20 Thread Johann Spies
I have the following in a model:

def horizontal_checkbox(f,v):
   return SQLFORM.widgets.checkboxes.widget(f,v, cols=5)

 Field('q3_1_1',
  requires = IS_IN_SET(['Training', 'Visits',
'Materials', 'Other'],
   multiple = True),
  widget = horizontal_checkbox),


On the entry form it accepts multiple entries and the entries are in the
database but when I use crud.update to edit the record, all the checkboxes
on that field are empty.

How do I correct that?

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: plugin_wiki widget jqgrid: colnames or columns?

2011-01-20 Thread blackthorne
I haven't sorted this out, but I take the title to report something
that could be documented, at least in the widget builder interface.

we have:
``col_width`` is the width of each column (default)

looking at the code, there is also:
col_widths which is a list of widths for each column

Best regards



On Jan 19, 5:03 pm, blackthorne francisco@gmail.com wrote:
 The way you define the column names in the Jqgrid plugin is done,
 according to the book, with the columns attribute is a list of
 columns names to be displayed. However, in the plugin_wiki widget
 builder interface that is done with the attribute colnames.
 In the code plugin_wiki controller, the used word seems to be
 columns as well.

 That said, I also couldn't make it with columns:

 ``
 name: jqgrid
 table: plugin_wiki_page
 fields: id,slug,description
 columns: title,slug,description
 width: 500
 col_width: [100,80,320]
 height: 300
 ``:widget

 Failed with:
 traceback:
 TypeError: jqgrid() got an unexpected keyword argument 'columns'

 Then I tried colnames:
 And I got a dialog window with the message:
 Length of colNames  colModel!


[web2py] Re: plugin_wiki widget jqgrid: colnames or columns?

2011-01-20 Thread blackthorne
Concerning my question, this is a bug.

Here is the patch: 
http://www.speedyshare.com/files/26373386/plugin_wiki_jqgrid_colnames_bug.patch
apply it to /application/models/plugin_wiki.py

the keyword to define jqgrid header names is now colnames and it's a
list of strings, such as:
colnames: dogs,cats,mouses

Best regards

On Jan 19, 5:03 pm, blackthorne francisco@gmail.com wrote:
 The way you define the column names in the Jqgrid plugin is done,
 according to the book, with the columns attribute is a list of
 columns names to be displayed. However, in the plugin_wiki widget
 builder interface that is done with the attribute colnames.
 In the code plugin_wiki controller, the used word seems to be
 columns as well.

 That said, I also couldn't make it with columns:

 ``
 name: jqgrid
 table: plugin_wiki_page
 fields: id,slug,description
 columns: title,slug,description
 width: 500
 col_width: [100,80,320]
 height: 300
 ``:widget

 Failed with:
 traceback:
 TypeError: jqgrid() got an unexpected keyword argument 'columns'

 Then I tried colnames:
 And I got a dialog window with the message:
 Length of colNames  colModel!


[web2py] Re: plugin_wiki widget jqgrid: colnames or columns?

2011-01-20 Thread blackthorne
Sorry, that link is wrong.
This is the one:
http://www.speedyshare.com/files/26373484/plugin_wiki_jqgrid_colnames_bug.patch

On Jan 20, 12:31 pm, blackthorne francisco@gmail.com wrote:
 Concerning my question, this is a bug.

 Here is the 
 patch:http://www.speedyshare.com/files/26373386/plugin_wiki_jqgrid_colnames...
 apply it to /application/models/plugin_wiki.py

 the keyword to define jqgrid header names is now colnames and it's a
 list of strings, such as:
 colnames: dogs,cats,mouses

 Best regards

 On Jan 19, 5:03 pm, blackthorne francisco@gmail.com wrote:



  The way you define the column names in the Jqgrid plugin is done,
  according to the book, with the columns attribute is a list of
  columns names to be displayed. However, in the plugin_wiki widget
  builder interface that is done with the attribute colnames.
  In the code plugin_wiki controller, the used word seems to be
  columns as well.

  That said, I also couldn't make it with columns:

  ``
  name: jqgrid
  table: plugin_wiki_page
  fields: id,slug,description
  columns: title,slug,description
  width: 500
  col_width: [100,80,320]
  height: 300
  ``:widget

  Failed with:
  traceback:
  TypeError: jqgrid() got an unexpected keyword argument 'columns'

  Then I tried colnames:
  And I got a dialog window with the message:
  Length of colNames  colModel!


[web2py] Re: plugin_wiki widget jqgrid: colnames or columns?

2011-01-20 Thread blackthorne
sorry for the mess, this is the right link.
I have to stop doing patchs manually ;/

http://www.speedyshare.com/files/26373627/plugin_wiki_jqgrid_colnames_bug.patch

On Jan 20, 12:36 pm, blackthorne francisco@gmail.com wrote:
 Sorry, that link is wrong.
 This is the 
 one:http://www.speedyshare.com/files/26373484/plugin_wiki_jqgrid_colnames...

 On Jan 20, 12:31 pm, blackthorne francisco@gmail.com wrote:



  Concerning my question, this is a bug.

  Here is the 
  patch:http://www.speedyshare.com/files/26373386/plugin_wiki_jqgrid_colnames...
  apply it to /application/models/plugin_wiki.py

  the keyword to define jqgrid header names is now colnames and it's a
  list of strings, such as:
  colnames: dogs,cats,mouses

  Best regards

  On Jan 19, 5:03 pm, blackthorne francisco@gmail.com wrote:

   The way you define the column names in the Jqgrid plugin is done,
   according to the book, with the columns attribute is a list of
   columns names to be displayed. However, in the plugin_wiki widget
   builder interface that is done with the attribute colnames.
   In the code plugin_wiki controller, the used word seems to be
   columns as well.

   That said, I also couldn't make it with columns:

   ``
   name: jqgrid
   table: plugin_wiki_page
   fields: id,slug,description
   columns: title,slug,description
   width: 500
   col_width: [100,80,320]
   height: 300
   ``:widget

   Failed with:
   traceback:
   TypeError: jqgrid() got an unexpected keyword argument 'columns'

   Then I tried colnames:
   And I got a dialog window with the message:
   Length of colNames  colModel!


[web2py] Re: plugin_wiki widget jqgrid: colnames or columns?

2011-01-20 Thread blackthorne
Concerning my question, this is a bug.

Here is the patch:
http://www.google.com/url?sa=Dq=http://www.speedyshare.com/files/26373627/plugin_wiki_jqgrid_colnames_bug.patch
apply it to /application/models/plugin_wiki.py

the keyword to define jqgrid header names is now colnames and it's
a
list of strings, such as:
colnames: dogs,cats,mouses

Best regards

On Jan 19, 5:03 pm, blackthorne francisco@gmail.com wrote:
 The way you define the column names in the Jqgrid plugin is done,
 according to the book, with the columns attribute is a list of
 columns names to be displayed. However, in the plugin_wiki widget
 builder interface that is done with the attribute colnames.
 In the code plugin_wiki controller, the used word seems to be
 columns as well.

 That said, I also couldn't make it with columns:

 ``
 name: jqgrid
 table: plugin_wiki_page
 fields: id,slug,description
 columns: title,slug,description
 width: 500
 col_width: [100,80,320]
 height: 300
 ``:widget

 Failed with:
 traceback:
 TypeError: jqgrid() got an unexpected keyword argument 'columns'

 Then I tried colnames:
 And I got a dialog window with the message:
 Length of colNames  colModel!


[web2py] Re: plugin_wiki widget jqgrid: colnames or columns?

2011-01-20 Thread blackthorne
I would also adopt the title to report something missing in the docs.
There is an undocumented features, it's the keyword col_widths which
is a list of numbers that defines specific widths for each jqgrid
column.

example:
..
col_widths: 100,80,200
..

I think this should be, at least, documented in the widget builder.


[web2py] mysql integration with web2py

2011-01-20 Thread jgp
I have developed a portal in web2py that uses sqlite and now i want to
shift the database to mysql.
I am trying to integrate mysql with web2py, but i am getting tickets
related to inconsistency issues.
Please help me in this regard.

Thanks in advance
JGP


[web2py] db list of blobs?

2011-01-20 Thread Jacob Gur
Hi-

Is there a way to do list of blobs in db? Looks like only options are
list of strings, numbers and references. GAE supports list of
anything, but it looks like web2py has not implemented a way to
serialize all types into a string to store in the other databases it
supports.

Obviously, I can create a table to store one blob per row and then use
list of references to achieve same effect, but I'm hoping there is a
simpler way.

Thanks.


Re: [web2py] mysql integration with web2py

2011-01-20 Thread rochacbruno
Can you show the traceback or any other message you are getting?

Em 20/01/2011, às 07:31, jgp jgp...@gmail.com escreveu:

 I have developed a portal in web2py that uses sqlite and now i want to
 shift the database to mysql.
 I am trying to integrate mysql with web2py, but i am getting tickets
 related to inconsistency issues.
 Please help me in this regard.
 
 Thanks in advance
 JGP


Re: [web2py] mysql integration with web2py

2011-01-20 Thread Thadeus Burgess
Can you share one of the tickets?

Another thing, you can add check_reserved to you DAL instantiation to make
sure your not using any reserved mysql keywords.

--
Thadeus




On Thu, Jan 20, 2011 at 7:13 AM, rochacbruno rochacbr...@gmail.com wrote:

 Can you show the traceback or any other message you are getting?

 Em 20/01/2011, às 07:31, jgp jgp...@gmail.com escreveu:

  I have developed a portal in web2py that uses sqlite and now i want to
  shift the database to mysql.
  I am trying to integrate mysql with web2py, but i am getting tickets
  related to inconsistency issues.
  Please help me in this regard.
 
  Thanks in advance
  JGP



[web2py] Re: JSON Data

2011-01-20 Thread DenesL

You either return the json yourself or you let web2py do it.

If you do it:

  response.headers['Content-Type']='application/json'
  return json.dumps(dict(id=ag.agenda.id, ...))

or if you want web2py to do it:

  return dict(id=ag.agenda.id, ...)

and call it with .../index.json
in this case you are using the generic.json view.


On Jan 19, 6:51 pm, contatogilson...@gmail.com
contatogilson...@gmail.com wrote:
 Hello guys,

 I'm wanting an action returns a json like this:

 {

     start: 2011-01-27,

     id: 4,

     title: Fulano Silva

 }

 Only to send to the view he is being rendered thus:

 quot;{\n \quot;start\quot;: \quot;2011-01-27\quot;, \n
 \quot;id\quot;: 4, \n \quot;title\quot;: \quot;Fulano
 Silva\quot;\n}quot;

 The code I made to return the JSON looks like:

 import simplejson as json

 def index():

     # Consultando os servicos do usuario logado

     query = db.agenda.id  0 and db.agenda.funcionario ==

  session.auth.user.id and db.agenda.cliente == db.cliente.id

      agenda = db(query).select(orderby = db.agenda.data)

     teste2 = list(agenda)

     for ag in agenda:

         teste =
 json.dumps({id:ag.agenda.id,title:ag.cliente.nome,start:ag.agenda.data.strftime('%Y-%m-%d')},indent=4)



     return dict(teste = response.json(teste))

 What should I do?
 _
 *Gilson Filho*
 *Web Developer
 Blog:* blog.gilsondev.com
 *Twitter:* twitter.com/gilsonfilho


[web2py] Re: Checkboxes(multiple) and editing data

2011-01-20 Thread Massimo Di Pierro
should be:

Field('q3_1_1','list:string',
  requires = IS_IN_SET(['Training', 'Visits',
'Materials', 'Other'],
   multiple = True),
  widget = horizontal_checkbox)


because multiple requires a string.

On Jan 20, 4:43 am, Johann Spies johann.sp...@gmail.com wrote:
 I have the following in a model:

 def horizontal_checkbox(f,v):
    return SQLFORM.widgets.checkboxes.widget(f,v, cols=5)

  Field('q3_1_1',
                       requires = IS_IN_SET(['Training', 'Visits',
 'Materials', 'Other'],
                                            multiple = True),
                       widget = horizontal_checkbox),

 On the entry form it accepts multiple entries and the entries are in the
 database but when I use crud.update to edit the record, all the checkboxes
 on that field are empty.

 How do I correct that?

 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: plugin_wiki widget jqgrid: colnames or columns?

2011-01-20 Thread Massimo Di Pierro
thanks. Will process this asap.

On Jan 20, 6:51 am, blackthorne francisco@gmail.com wrote:
 Concerning my question, this is a bug.

 Here is the 
 patch:http://www.google.com/url?sa=Dq=http://www.speedyshare.com/files/263...
 apply it to /application/models/plugin_wiki.py

 the keyword to define jqgrid header names is now colnames and it's
 a
 list of strings, such as:
 colnames: dogs,cats,mouses

 Best regards

 On Jan 19, 5:03 pm, blackthorne francisco@gmail.com wrote:







  The way you define the column names in the Jqgrid plugin is done,
  according to the book, with the columns attribute is a list of
  columns names to be displayed. However, in the plugin_wiki widget
  builder interface that is done with the attribute colnames.
  In the code plugin_wiki controller, the used word seems to be
  columns as well.

  That said, I also couldn't make it with columns:

  ``
  name: jqgrid
  table: plugin_wiki_page
  fields: id,slug,description
  columns: title,slug,description
  width: 500
  col_width: [100,80,320]
  height: 300
  ``:widget

  Failed with:
  traceback:
  TypeError: jqgrid() got an unexpected keyword argument 'columns'

  Then I tried colnames:
  And I got a dialog window with the message:
  Length of colNames  colModel!


Re: [web2py] Re: Bug? SQLFORM.factory and SQLFORM differ in handling of hidden form fields

2011-01-20 Thread Nathan VanHoudnos
Done: http://code.google.com/p/web2py/issues/detail?id=162

http://code.google.com/p/web2py/issues/detail?id=162Thanks!

On Tue, Jan 18, 2011 at 4:29 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 This is a bug. Would you please post your bug report email on
 googlecode? I will fix it asap.

 On Jan 18, 12:23 pm, Nathan VanHoudnos nathan...@gmail.com wrote:
  Hi,
 
  A minimal example:
  likertRightAnswer = ['Yes', 'No', 'Impossible to tell']
 
  form = SQLFORM.factory(
  Field('rightAnswer',
widget=horizontal_radios,
requires=IS_IN_SET(likertRightAnswer,
   error_message=T('Please choose a
  response.'))),
  hidden={'timestart':request.now.strftime('%Y-%m-%d %H:%M:%S')}
  )
 
  In this case, BEAUTIFY(request.post_vars) will include, timestart and
  rightAnswer, but BEAUTIFY(form.vars) will only include rightAnswer.
 
  If we instead setup the appropriate db as db.ratings, and then do:
  likertRightAnswer = ['Yes', 'No', 'Impossible to tell']
 
  form = SQLFORM(db.ratings,
  hidden={'timestart':request.now.strftime('%Y-%m-%d %H:%M:%S')}
  )
 
  In this case, both BEAUTIFY(request.post_vars) and BEAUTIFY(form.vars)
 will
  both include timestart and rightAnswer.
 
  The second behavior is more expected at least to me.
 
  Right now, I'm using request.post_vars.timestart to access the value
 after
  the form.accepts call, but this feels like I'm hacking something
 together.
 
  And it essentially circumvents the security feature discussed in this
  thread:
 
  http://groups.google.com/group/web2py/browse_thread/thread/ab21d9d216...
 
  So is this a bug? Or should I be doing something different? (My
 application
  creates a bunch of little temporary forms and I don't want to bloat
  the data-store with them.)
 
  Cheers,
  --
  Nathan VanHoudnos
  |- Statistics  Public Policy PhD student
  |- Program for Interdisciplinary Education Research (PIER) Fellowship
  |- Carnegie Mellon University
  |-http://www.andrew.cmu.edu/user/nmv
 
  Neglect of mathematics works injury to all knowledge,
   since he who is ignorant of it cannot know the other
   sciences or the things of this world. -- Roger Bacon




-- 
Nathan VanHoudnos
|- Statistics  Public Policy PhD student
|- Program for Interdisciplinary Education Research (PIER) Fellowship
|- Carnegie Mellon University
|- http://www.andrew.cmu.edu/user/nmv

Neglect of mathematics works injury to all knowledge,
 since he who is ignorant of it cannot know the other
 sciences or the things of this world. -- Roger Bacon


Re: [web2py] Re: Checkboxes(multiple) and editing data

2011-01-20 Thread Johann Spies
Thank you very much!

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: JSON Data

2011-01-20 Thread contatogilson...@gmail.com
I want it to be rendered directly in the javascript:

...

events: [{{}} = jsonData]

_
*Gilson Filho*
*Web Developer
Blog:* blog.gilsondev.com
*Twitter:* twitter.com/gilsonfilho



2011/1/20 DenesL denes1...@yahoo.ca


 You either return the json yourself or you let web2py do it.

 If you do it:

  response.headers['Content-Type']='application/json'
  return json.dumps(dict(id=ag.agenda.id, ...))

 or if you want web2py to do it:

  return dict(id=ag.agenda.id, ...)

 and call it with .../index.json
 in this case you are using the generic.json view.


 On Jan 19, 6:51 pm, contatogilson...@gmail.com
 contatogilson...@gmail.com wrote:
  Hello guys,
 
  I'm wanting an action returns a json like this:
 
  {
 
  start: 2011-01-27,
 
  id: 4,
 
  title: Fulano Silva
 
  }
 
  Only to send to the view he is being rendered thus:
 
  quot;{\n \quot;start\quot;: \quot;2011-01-27\quot;, \n
  \quot;id\quot;: 4, \n \quot;title\quot;: \quot;Fulano
  Silva\quot;\n}quot;
 
  The code I made to return the JSON looks like:
 
  import simplejson as json
 
  def index():
 
  # Consultando os servicos do usuario logado
 
  query = db.agenda.id  0 and db.agenda.funcionario ==
 
   session.auth.user.id and db.agenda.cliente == db.cliente.id
 
   agenda = db(query).select(orderby = db.agenda.data)
 
  teste2 = list(agenda)
 
  for ag in agenda:
 
  teste =
  json.dumps({id:ag.agenda.id
 ,title:ag.cliente.nome,start:ag.agenda.data.strftime('%Y-%m-%d')},indent=4)
 
 
 
  return dict(teste = response.json(teste))
 
  What should I do?
  _
  *Gilson Filho*
  *Web Developer
  Blog:* blog.gilsondev.com
  *Twitter:* twitter.com/gilsonfilho



[web2py] Re: db list of blobs?

2011-01-20 Thread Massimo Di Pierro
I am not sure I fully understand. Can you please provide an example?

On Jan 20, 6:52 am, Jacob Gur ja...@camdenbody.com wrote:
 Hi-

 Is there a way to do list of blobs in db? Looks like only options are
 list of strings, numbers and references. GAE supports list of
 anything, but it looks like web2py has not implemented a way to
 serialize all types into a string to store in the other databases it
 supports.

 Obviously, I can create a table to store one blob per row and then use
 list of references to achieve same effect, but I'm hoping there is a
 simpler way.

 Thanks.


[web2py] Re: geo spatial GIS in web2py

2011-01-20 Thread KK
I would really be interested in getting the code or if you can post the code 
somewhere.  If I do something based off of that I will contribute back to 
the community.  Thanks.

Re: [web2py] web2pyslices migration

2011-01-20 Thread Offray Vladimir Luna Cárdenas
Hi Bruno,

Thanks for your work. I will insist on my idea :) of creating a web2py
minimalist self-contained distributed network using it with fossil-scm
and recommend keep us updated with your advances so newbies like me can
learn from that process.

Cheers,

Offray

El 18/01/11 20:16, Bruno Rocha escribió:
 Hello everyone.
 
 web2pyslices server is being migrated from Nathan server for
 my server, so the site can be down for a while, I'll try to put it
 to work as quickly as possible. Max tomorrow evening the site will
 be back and running on my new server, no change and keeping the same
 data and users.
 
 Me and Martin have begun work on a new site for web2pyslices, we plan this
 to bea sort of central resource for developers working with
 web2py, and a kind of social network of
 programmers that will contain recipes, plugins, applications,
 tips, videos, tutorials and people for sharing information about web2py. (we
 have some other secret ideas for the site)
 
 We will try to integrate the most from the book, from the official site, the
 group and the most used social networking(facebook, twitter, bitbucket,
 github, etc).
 
 But this is a hard work and certainly take
 us a bit of time, web2pyslices continue working until when we're
 ready to migrate all the existing content to the new site.
 
 For now we are working to establish the foundations of this new
 application and any hint, suggestion, idea will be thoroughly evaluated.
 
 Thanks and sorry if it goes off for some time.
 
 ---
 Bruno Rocha
 http://about.me/rochacbruno/bio
 



[web2py] Change URL

2011-01-20 Thread walter
Is there possibility to change the standard URL of the form
http://my_site.net/application/default/action to something like
http://my_site.net/default/action?


Re: [web2py] Change URL

2011-01-20 Thread Bruno Rocha
See autoroutes.py in the scripts folder.

You need this: http://snipt.net/rochacbruno/routesconf/
and this: http://snipt.net/rochacbruno/routespy/

--
Bruno Rocha
http://about.me/rochacbruno/bio


2011/1/20 walter wdv...@gmail.com

 Is there possibility to change the standard URL of the form
 http://my_site.net/application/default/action to something like
 http://my_site.net/default/action?


[web2py] Re: reply-to setting in Mail()

2011-01-20 Thread cjrh
On Jan 19, 12:45 am, Anthony abasta...@gmail.com wrote:
 the book and/or the admin interface). Also, rather than label it Epydoc
 (which is actually the name of the tool used to generate it), maybe call it
 something more descriptive, like API Documentation or Source Code
 Documentation.

+1


[web2py] Should I store miscellaneous user data in auth_user?

2011-01-20 Thread scausten
I've got a few items of supplementary data about my users relating to
my e-commerce app, including current balance, total earnings, and
other bits and pieces. Because these are not directly related to
access control, I have a gut feeling that I should store them in a
different table and have a single reference from auth_user to these
miscellaneous data.

What are people's thoughts on best practice for this?


Re: [web2py] Temporary changing default values of a Form

2011-01-20 Thread Arun K.Rajeevan
Does anybody know how to do it for a select box?
Select box is rendered because it's a foreign key that reference another 
table.


[web2py] Re: web2pyslices migration

2011-01-20 Thread Arun K.Rajeevan
Great.
We really need a location to point to apart from web2py.com.


Re: [web2py] Should I store miscellaneous user data in auth_user?

2011-01-20 Thread Bruno Rocha
I think the best pratice is a different table, then you make a reference
between tables using the user_id.

It is easy with DAL because you can do traversing, for example

db.define_table('userinfo',Field('user_id',db.auth_user,requires=IS_IN_DB(...)),Field(''),Field('...'))

userlist = db(db.userinfo.user_id==foo).select().first()

name = userlist.user_id.first_name
email = userlist.user_id.email
...

You need to query just the second table to get the data on the first one,
and you dont need to redefine the auth_user model.

Bruno Rocha
http://about.me/rochacbruno/bio


2011/1/20 scausten scaus...@gmail.com

 I've got a few items of supplementary data about my users relating to
 my e-commerce app, including current balance, total earnings, and
 other bits and pieces. Because these are not directly related to
 access control, I have a gut feeling that I should store them in a
 different table and have a single reference from auth_user to these
 miscellaneous data.

 What are people's thoughts on best practice for this?


Re: [web2py] Re: web2pyslices migration

2011-01-20 Thread Bruno Rocha
Everything is a '*Slice*' of web2py so we want to create a place where these
slices have a meeting.

People, Plugins, Articles, Links, Apps, Projects etc, All in one place.

We just started the work, hope to release the alpha.web2pyslices.com in few
days

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Temporary changing default values of a Form

2011-01-20 Thread Kenneth Lundström

 Does anybody know how to do it for a select box?
 Select box is rendered because it's a foreign key that reference 
another table.


After you have created the form but before if form.accepts define your 
default.


form = SQLFORM(db...)

form.vars.type = 'cleaner'

if form.accepts..

This should work.


Kenneth




[web2py] Re: Use the source, Luca

2011-01-20 Thread Arun K.Rajeevan
Source is great documentation by itself I agree.
But when I started to go through source,
I can see a couple of functions with no docstrings, there may be more like 
so.
And for a total newbie to source, just be there to troubleshoot something 
it'll be hard.
Because there's no docstrings he must go through the code with no knowledge 
of what it does and may be he has to jump into another functions and/or 
modules to get fuller understanding. 

So, there's a great need to properly comment the source wherever necessary 
first. 


Re: [web2py] Re: Shell controllers views

2011-01-20 Thread Arun K.Rajeevan
I too was wondering after I read flame wars on reddit about web2py vs 
django.
Do everything in the shell philosophy... ;)

Also, I wanted to test my controllers and templates in the shell itself.

yesterday I read the tests for the first time and saw something that does 
what I want.  
But I wasn't sure about it.

Bruno, your examples helped a lot and saved a lot of time that may otherwise 
spend for figure this out.
Thanks :)


Re: [web2py] Should I store miscellaneous user data in auth_user?

2011-01-20 Thread Bruno Rocha
But, if you want a customized auth_user table, here is a good example

https://bitbucket.org/hc/scanme/src/743ed270faae/models/db_scanme.py

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] displaying process output to the screen

2011-01-20 Thread mart
Hi,

Does anyone have a quick ad dirty trick to display process output to a
web age (a panel or something)?

Thanks,
Mart :)


[web2py] Re: [off-topic] - Jquery Panels/dashboard Plugin

2011-01-20 Thread Arun K.Rajeevan
I saw a reference about jpolite when I was reading source.
It's in some todo section, stating to merge jpolite with kpax (if I'm 
right.)

Since then I was wondering what it's.
I liked the app (haven't looked the source)

Is it simpler than going the pyjamas way (which is complete js ui and no SEO 
- I guess) or GWT + ExtJS ?


[web2py] pyQT web2py

2011-01-20 Thread mart
Hi,

has anyone considered using pyQT within their apps? and if yes, any
comments on its use?

Thanks,
Mart :)


[web2py] Re: sqlform.factory, inserting variable number of records in an other table

2011-01-20 Thread Arun K.Rajeevan
The more dynamic the site develops into, I think it's better to use 
something like GWT (or pyjams)

You don't have to sacrifice SEO by building complete site in GWT but only 
parts of it.
That way, you can utilize best of both worlds. 
If you are using gwt you utilize many other grate libraries available (like 
ext-js wrapper for gwt)

May be this is not what you want. but an attempt to use gwt (or pyjams) 
helps to write code in same language as we develop and is more manageable ( 
for me at least)


Re: [web2py] Re: web2pyslices migration

2011-01-20 Thread Arun K.Rajeevan
Is that secret is making everything slice ?!! :D

[web2py] Re: Should I store miscellaneous user data in auth_user?

2011-01-20 Thread scausten
Thanks Bruno - just out of interest, why do you prefer to use
db[auth.settings.table_user_name] over db.auth_user?

On Jan 20, 8:01 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 But, if you want a customized auth_user table, here is a good example

 https://bitbucket.org/hc/scanme/src/743ed270faae/models/db_scanme.py

 Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: pyQT web2py

2011-01-20 Thread blackthorne
yes, I fully recommend it. i think it's the best way of developing gui
in a portable and native-respectful way. you also have Pyside.

Qt creator is great. you can use Qt designer with pyuic for
translation.

make your questions, I will try to answer even though it is fairly
offtopic.

On Jan 20, 8:08 pm, mart msenecal...@gmail.com wrote:
 Hi,

 has anyone considered using pyQT within their apps? and if yes, any
 comments on its use?

 Thanks,
 Mart :)


Re: [web2py] Re: sqlform.factory, inserting variable number of records in an other table

2011-01-20 Thread Richard Vézina
I am hacking a lot to build a function to parse the resultant form to insert
as many rows as there is added with the js I write...

It is quite tricky for me since I am not so experienced in the web2py dev...
I dev app... But dev web2py is something else. I will propose something far
from be complete solution. And I don't know if it will not introduce
security concern into web2py.

I need to be able to load more then one table at a time and let user add the
number of sub table rows he needs... Maybe I am not doing it the right
way...

Maybe I should add input fields from python and regenerate a new form each
time don't know... Will see what Massimo and other users think.

I hope I have something working tomorrow.

I have not actually look at what will happen with validator... It is mostly
work in progress.

;-)

Richard



On Thu, Jan 20, 2011 at 3:11 PM, Arun K.Rajeevan the1.a...@gmail.comwrote:

 The more dynamic the site develops into, I think it's better to use
 something like GWT (or pyjams)

 You don't have to sacrifice SEO by building complete site in GWT but only
 parts of it.
 That way, you can utilize best of both worlds.
 If you are using gwt you utilize many other grate libraries available (like
 ext-js wrapper for gwt)

 May be this is not what you want. but an attempt to use gwt (or pyjams)
 helps to write code in same language as we develop and is more manageable (
 for me at least)



[web2py] Obtain label for field with IS_IN_SET

2011-01-20 Thread Álvaro J . Iradier
I found thread where someone asked exactly the same question I'm
trying to solve:

http://groups.google.com/group/web2py/browse_thread/thread/ba58ec07a23b0393/

but the question wasn't answered, quoting from the last post:

---
...

In a controller I defined a form:

form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],labels=['Fitnesscentrum','Fysiofitnesscentrum','Personal
Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))

...

Massimo,

I am not sure you did understand my question correctly.

When in the form the user selects 'Fitnesscentre' in the drop box, the
function that selects all the Fitnesscentres takes 2 as its argument.
I would like the flash in the view to display something like:

Fitnesscentres in Amsterdam

request.vars.city gives me Amsterdam, what I am looking for is
something similar for Fitnesscentres, however, request.vars.bedrijf
gives me 2.
---

Is it possible?

Thanks very much,


[web2py] Re: Obtain label for field with IS_IN_SET

2011-01-20 Thread Massimo Di Pierro
I am still not sure but I will give it a try:

options=[(2,'Fitnesscentrum'),(3,'Fysiofitnesscentrum'),(4,'Personal
Trainer'),(5,'Dietist(e)'),(6,'Voedingsconsulent(e)'),
(7,'Yogaschool')]

def index():
form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET(options)),
 Field('city'))
if form.accepts(request):
response.flash='%s in %s' (dict(options)
[int(form.vars.bedrijf)],form.vars.city)
return dict(form=form)

form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],label
s=['Fitnesscentrum','Fysiofitnesscentrum','Personal
Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))


On Jan 20, 3:15 pm, Álvaro J. Iradier airad...@gmail.com wrote:
 I found thread where someone asked exactly the same question I'm
 trying to solve:

 http://groups.google.com/group/web2py/browse_thread/thread/ba58ec07a2...

 but the question wasn't answered, quoting from the last post:

 ---
 ...

 In a controller I defined a form:

 form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],label 
 s=['Fitnesscentrum','Fysiofitnesscentrum','Personal
 Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))

 ...

 Massimo,

 I am not sure you did understand my question correctly.

 When in the form the user selects 'Fitnesscentre' in the drop box, the
 function that selects all the Fitnesscentres takes 2 as its argument.
 I would like the flash in the view to display something like:

 Fitnesscentres in Amsterdam

 request.vars.city gives me Amsterdam, what I am looking for is
 something similar for Fitnesscentres, however, request.vars.bedrijf
 gives me 2.
 ---

 Is it possible?

 Thanks very much,


[web2py] Re: pyQT web2py

2011-01-20 Thread mart
This is great to hear! I was looking at making a few pieces (with a
UI) that would have both web version and non-web version! So, I made a
note that blackthorne knows all about this when I get stuck! :)


Thanks for that!
Mart :)

On Jan 20, 3:46 pm, blackthorne francisco@gmail.com wrote:
 yes, I fully recommend it. i think it's the best way of developing gui
 in a portable and native-respectful way. you also have Pyside.

 Qt creator is great. you can use Qt designer with pyuic for
 translation.

 make your questions, I will try to answer even though it is fairly
 offtopic.

 On Jan 20, 8:08 pm, mart msenecal...@gmail.com wrote:







  Hi,

  has anyone considered using pyQT within their apps? and if yes, any
  comments on its use?

  Thanks,
  Mart :)


Re: [web2py] displaying process output to the screen

2011-01-20 Thread Philippe ENTZMANN
Via the Python logging module.
This is a code snippet I use to set a log file (if your process is in Python) :

log = logging.getLogger(checkmail)
log.setLevel(logging.DEBUG)
fh = logging.FileHandler(../logs/checkmail.log)
fh.setLevel(logging.DEBUG)
# create formatter and add it to the handlers
formatter = logging.Formatter(%(asctime)s - %(name)s -
%(levelname)s - %(message)s)
fh.setFormatter(formatter)
# add the handlers to logger
log.addHandler(fh)

Your controller will do :
 return dict(data=open(/application/myapp/logs/checkmail.log).readlines())

If your process is not a Python program, you can redirect output to a
file via a shell redirection () or with the subprocess module.

2011/1/20 mart msenecal...@gmail.com:
 Hi,

 Does anyone have a quick ad dirty trick to display process output to a
 web age (a panel or something)?

 Thanks,
 Mart :)



[web2py] Re: sqlform.factory, inserting variable number of records in an other table

2011-01-20 Thread mart
I would really look at the Massimo's audit trail sample to do what
you are saying (or a mix of both?)... This is how I manage the request
app I mentioned (Like a recipe : many tables with few Fields (like
name:value) are put together... with a large enough inventory of
tables it becomes easy to extend and  move forward with changing
demand... Anyways, I still need to try a few things that you mentioned
yesterday... The mental picture I keep in the back of my mind when
looking at what you sent looks like something I would use to manage
monthly bills (add a field for a new bill, and link it to a
category)... Here I would use a drop down to choose a table (like work
expense, or house expense, or kids, etc )... Does that define what
you are looking to do?

On Jan 20, 3:54 pm, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 I am hacking a lot to build a function to parse the resultant form to insert
 as many rows as there is added with the js I write...

 It is quite tricky for me since I am not so experienced in the web2py dev...
 I dev app... But dev web2py is something else. I will propose something far
 from be complete solution. And I don't know if it will not introduce
 security concern into web2py.

 I need to be able to load more then one table at a time and let user add the
 number of sub table rows he needs... Maybe I am not doing it the right
 way...

 Maybe I should add input fields from python and regenerate a new form each
 time don't know... Will see what Massimo and other users think.

 I hope I have something working tomorrow.

 I have not actually look at what will happen with validator... It is mostly
 work in progress.

 ;-)

 Richard

 On Thu, Jan 20, 2011 at 3:11 PM, Arun K.Rajeevan the1.a...@gmail.comwrote:







  The more dynamic the site develops into, I think it's better to use
  something like GWT (or pyjams)

  You don't have to sacrifice SEO by building complete site in GWT but only
  parts of it.
  That way, you can utilize best of both worlds.
  If you are using gwt you utilize many other grate libraries available (like
  ext-js wrapper for gwt)

  May be this is not what you want. but an attempt to use gwt (or pyjams)
  helps to write code in same language as we develop and is more manageable (
  for me at least)


[web2py] Re: displaying process output to the screen

2011-01-20 Thread mart
yeah, its all python... Are you able to refresh quickly enough (like
with large file processing) ? I log everything to a few tables, so, I
should be able to use what you're saying but by querying the DB
instead of open/read/close a file repeatedly?

This a great idea! Thanks :)

On Jan 20, 4:42 pm, Philippe ENTZMANN philippe.entzm...@gmail.com
wrote:
 Via the Python logging module.
 This is a code snippet I use to set a log file (if your process is in Python) 
 :

     log = logging.getLogger(checkmail)
     log.setLevel(logging.DEBUG)
     fh = logging.FileHandler(../logs/checkmail.log)
     fh.setLevel(logging.DEBUG)
     # create formatter and add it to the handlers
     formatter = logging.Formatter(%(asctime)s - %(name)s -
 %(levelname)s - %(message)s)
     fh.setFormatter(formatter)
     # add the handlers to logger
     log.addHandler(fh)

 Your controller will do :
      return 
 dict(data=open(/application/myapp/logs/checkmail.log).readlines())

 If your process is not a Python program, you can redirect output to a
 file via a shell redirection () or with the subprocess module.

 2011/1/20 mart msenecal...@gmail.com:







  Hi,

  Does anyone have a quick ad dirty trick to display process output to a
  web age (a panel or something)?

  Thanks,
  Mart :)


[web2py] Re: Obtain label for field with IS_IN_SET

2011-01-20 Thread Álvaro J . Iradier
Thanks Massimo, that worked perfectly.

I wasn't aware of the [('id1', 'label1'), ('id2', 'label2')] syntax
for IS_IN_SET.

Thanks for the quick response!

On 20 ene, 22:30, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I am still not sure but I will give it a try:

 options=[(2,'Fitnesscentrum'),(3,'Fysiofitnesscentrum'),(4,'Personal
 Trainer'),(5,'Dietist(e)'),(6,'Voedingsconsulent(e)'),
 (7,'Yogaschool')]

 def index():
     form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET(options)),
                          Field('city'))
     if form.accepts(request):
         response.flash='%s in %s' (dict(options)
 [int(form.vars.bedrijf)],form.vars.city)
     return dict(form=form)

 form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],label
 s=['Fitnesscentrum','Fysiofitnesscentrum','Personal
 Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))

 On Jan 20, 3:15 pm, Álvaro J. Iradier airad...@gmail.com wrote:







  I found thread where someone asked exactly the same question I'm
  trying to solve:

 http://groups.google.com/group/web2py/browse_thread/thread/ba58ec07a2...

  but the question wasn't answered, quoting from the last post:

  ---
  ...

  In a controller I defined a form:

  form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],label 
  s=['Fitnesscentrum','Fysiofitnesscentrum','Personal
  Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))

  ...

  Massimo,

  I am not sure you did understand my question correctly.

  When in the form the user selects 'Fitnesscentre' in the drop box, the
  function that selects all the Fitnesscentres takes 2 as its argument.
  I would like the flash in the view to display something like:

  Fitnesscentres in Amsterdam

  request.vars.city gives me Amsterdam, what I am looking for is
  something similar for Fitnesscentres, however, request.vars.bedrijf
  gives me 2.
  ---

  Is it possible?

  Thanks very much,


Re: [web2py] Re: sqlform.factory, inserting variable number of records in an other table

2011-01-20 Thread Richard Vézina
Client
Address


1 client can have many address...

In web2py as far as I know you will do form creating client 1 in Client
table

Then go in form address and add as many address you need to to a client that
you pick in a dropdown.

I would like to add the many address in one form :

Here the fields of the form :

Name
Street
City

So

Name is Client field

Street and city are Address field

You can handle the form generation with SQLFORM.factory(db.client,
db.address)

Then the js I wrote let you add as many input you want for subform or table
Address.

So you get a new form from the view and you need to process the inputs to
insert street and city from each inputs by pairs...

street input1
city input1
insert

street input2
city input2
insert

Etc.

I near of it...

Richard




On Thu, Jan 20, 2011 at 4:47 PM, mart msenecal...@gmail.com wrote:

 I would really look at the Massimo's audit trail sample to do what
 you are saying (or a mix of both?)... This is how I manage the request
 app I mentioned (Like a recipe : many tables with few Fields (like
 name:value) are put together... with a large enough inventory of
 tables it becomes easy to extend and  move forward with changing
 demand... Anyways, I still need to try a few things that you mentioned
 yesterday... The mental picture I keep in the back of my mind when
 looking at what you sent looks like something I would use to manage
 monthly bills (add a field for a new bill, and link it to a
 category)... Here I would use a drop down to choose a table (like work
 expense, or house expense, or kids, etc )... Does that define what
 you are looking to do?

 On Jan 20, 3:54 pm, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  I am hacking a lot to build a function to parse the resultant form to
 insert
  as many rows as there is added with the js I write...
 
  It is quite tricky for me since I am not so experienced in the web2py
 dev...
  I dev app... But dev web2py is something else. I will propose something
 far
  from be complete solution. And I don't know if it will not introduce
  security concern into web2py.
 
  I need to be able to load more then one table at a time and let user add
 the
  number of sub table rows he needs... Maybe I am not doing it the right
  way...
 
  Maybe I should add input fields from python and regenerate a new form
 each
  time don't know... Will see what Massimo and other users think.
 
  I hope I have something working tomorrow.
 
  I have not actually look at what will happen with validator... It is
 mostly
  work in progress.
 
  ;-)
 
  Richard
 
  On Thu, Jan 20, 2011 at 3:11 PM, Arun K.Rajeevan the1.a...@gmail.com
 wrote:
 
 
 
 
 
 
 
   The more dynamic the site develops into, I think it's better to use
   something like GWT (or pyjams)
 
   You don't have to sacrifice SEO by building complete site in GWT but
 only
   parts of it.
   That way, you can utilize best of both worlds.
   If you are using gwt you utilize many other grate libraries available
 (like
   ext-js wrapper for gwt)
 
   May be this is not what you want. but an attempt to use gwt (or pyjams)
   helps to write code in same language as we develop and is more
 manageable (
   for me at least)



[web2py] SQLFORM not working on GAE

2011-01-20 Thread Tito Garrido
I'm using the latest version of web2py and I'm not sure why the SQLFORM is
not working on GAE. Out of GAE webserver the form works as expected, but on
gae it doesn't return anything, just refreshs the page...

*
form=SQLFORM(db.jogo,fields=['nome','console','descricao','foto'],submit_button='Adicionar')
if form.accepts(request.vars, session):
session.flash='Jogo adicionado'
redirect(URL('adicionar_jogo'))
elif form.errors:
response.flash='Existem errors no formulário'

return dict(form=form,table=powerTable.create())*


Anything missing there?

Regards,

Tito

-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


Re: [web2py] Re: displaying process output to the screen

2011-01-20 Thread Philippe ENTZMANN
'quickness' depends on how fast your log is filling.
Log size matters too.

I usually offer two views of my logs.
One is a full/slow/not refreshing view of the entire file.
The other is a partial/fast/auto-refreshing view of the last 20-50
lines (via a tail command).

For specific realtime needs, I have once used a message queue
(orbited) to broadcast log messages to web clients in real-time.
But this is quite over-sophisticated !!

Storing log in database sounds like bad idea :
Log size will decrease performance of all operations (even if it is
not log related).
Logging module have rotating file feature to avoid filling your disk
with ever-growing logs.
You will never lock your database with logging to files.


2011/1/20 mart msenecal...@gmail.com:
 yeah, its all python... Are you able to refresh quickly enough (like
 with large file processing) ? I log everything to a few tables, so, I
 should be able to use what you're saying but by querying the DB
 instead of open/read/close a file repeatedly?

 This a great idea! Thanks :)

 On Jan 20, 4:42 pm, Philippe ENTZMANN philippe.entzm...@gmail.com
 wrote:
 Via the Python logging module.
 This is a code snippet I use to set a log file (if your process is in 
 Python) :

     log = logging.getLogger(checkmail)
     log.setLevel(logging.DEBUG)
     fh = logging.FileHandler(../logs/checkmail.log)
     fh.setLevel(logging.DEBUG)
     # create formatter and add it to the handlers
     formatter = logging.Formatter(%(asctime)s - %(name)s -
 %(levelname)s - %(message)s)
     fh.setFormatter(formatter)
     # add the handlers to logger
     log.addHandler(fh)

 Your controller will do :
      return 
 dict(data=open(/application/myapp/logs/checkmail.log).readlines())

 If your process is not a Python program, you can redirect output to a
 file via a shell redirection () or with the subprocess module.

 2011/1/20 mart msenecal...@gmail.com:







  Hi,

  Does anyone have a quick ad dirty trick to display process output to a
  web age (a panel or something)?

  Thanks,
  Mart :)



[web2py] Re: web2py and external editors

2011-01-20 Thread Mike Rans
Thanks very much Niphlod and Plumo. I will check out these possible
solutions.


[web2py] Re: SQLFORM not working on GAE

2011-01-20 Thread Martin.Mulone
db definition?.
exception message?.




[web2py] Re: displaying process output to the screen

2011-01-20 Thread mart
Good point for the use if the DB, But in this case, its for a build
process, so its all about capturing and storing data. Every build
creates a throw away DB, so most are short lived. Only part of the
collected data throughout the build will make it to the central DB,
and even then, only if it qualifies...  I really like your 2 logs
idea, I think that would provide for both purposes.

Thanks again,
Mart :)


On Jan 20, 5:31 pm, Philippe ENTZMANN philippe.entzm...@gmail.com
wrote:
 'quickness' depends on how fast your log is filling.
 Log size matters too.

 I usually offer two views of my logs.
 One is a full/slow/not refreshing view of the entire file.
 The other is a partial/fast/auto-refreshing view of the last 20-50
 lines (via a tail command).

 For specific realtime needs, I have once used a message queue
 (orbited) to broadcast log messages to web clients in real-time.
 But this is quite over-sophisticated !!

 Storing log in database sounds like bad idea :
 Log size will decrease performance of all operations (even if it is
 not log related).
 Logging module have rotating file feature to avoid filling your disk
 with ever-growing logs.
 You will never lock your database with logging to files.

 2011/1/20 mart msenecal...@gmail.com:







  yeah, its all python... Are you able to refresh quickly enough (like
  with large file processing) ? I log everything to a few tables, so, I
  should be able to use what you're saying but by querying the DB
  instead of open/read/close a file repeatedly?

  This a great idea! Thanks :)

  On Jan 20, 4:42 pm, Philippe ENTZMANN philippe.entzm...@gmail.com
  wrote:
  Via the Python logging module.
  This is a code snippet I use to set a log file (if your process is in 
  Python) :

      log = logging.getLogger(checkmail)
      log.setLevel(logging.DEBUG)
      fh = logging.FileHandler(../logs/checkmail.log)
      fh.setLevel(logging.DEBUG)
      # create formatter and add it to the handlers
      formatter = logging.Formatter(%(asctime)s - %(name)s -
  %(levelname)s - %(message)s)
      fh.setFormatter(formatter)
      # add the handlers to logger
      log.addHandler(fh)

  Your controller will do :
       return 
  dict(data=open(/application/myapp/logs/checkmail.log).readlines())

  If your process is not a Python program, you can redirect output to a
  file via a shell redirection () or with the subprocess module.

  2011/1/20 mart msenecal...@gmail.com:

   Hi,

   Does anyone have a quick ad dirty trick to display process output to a
   web age (a panel or something)?

   Thanks,
   Mart :)


[web2py] Re: pyQT web2py

2011-01-20 Thread blackthorne
wrong note!
I like it, I consider it the best way of making GUI's for many reasons
but I am beginner on it.

However, I think it may be interesting the creation of systems with
multiple interfaces.
In fact, I had the idea of the web 6.0 :) as I called it, by
defining metadata threw the web that dynamically generates native
interfaces using Qt as you surf the web. Websites would appear as real
and coherent applications in your system.
Recently, Apple did something like this with the iPhone OS.

Anyway, feel free to contact me but you may have better luck by trying
the #Pyqt channel on irc.freenode.net

Best regards

On Jan 20, 9:39 pm, mart msenecal...@gmail.com wrote:
 This is great to hear! I was looking at making a few pieces (with a
 UI) that would have both web version and non-web version! So, I made a
 note that blackthorne knows all about this when I get stuck! :)

 Thanks for that!
 Mart :)

 On Jan 20, 3:46 pm, blackthorne francisco@gmail.com wrote:



  yes, I fully recommend it. i think it's the best way of developing gui
  in a portable and native-respectful way. you also have Pyside.

  Qt creator is great. you can use Qt designer with pyuic for
  translation.

  make your questions, I will try to answer even though it is fairly
  offtopic.

  On Jan 20, 8:08 pm, mart msenecal...@gmail.com wrote:

   Hi,

   has anyone considered using pyQT within their apps? and if yes, any
   comments on its use?

   Thanks,
   Mart :)


Re: [web2py] Re: web2pyslices migration

2011-01-20 Thread Martin.Mulone
:O the rumors run fast

[web2py] Re: pyQT web2py

2011-01-20 Thread Stefaan Himpe

Hello,

It's not clear to me how you would combine PyQt (or PySide) with web2py 
in the same application, it doesn't seem to make much sense to me.


Provided you could actually make this work, a PyQt UI embedded in a 
web2py application would only be visible on the server (e.g. some google 
data center), not on the client (user of the web application).


Of course I could have misunderstood: you could make a PyQt UI that 
requests services from a web2py web application using xmlrpc.

In that case both applications are completely separate from each other.

If you want to make both a web and desktop version of the same 
application (e.g. a bug database that can run both in your web browser,
or as a standalone desktop program), perhaps pyjamas is something worth 
looking at: http://pyjs.org/


Best regards,
Stefaan.



[web2py] Adding restructuredtext support for plugin_wiki or translating to markmin

2011-01-20 Thread Offray Vladimir Luna Cárdenas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

It has been a lot of fun getting my web2py server on-line. I have tried
before Zope/Plone/Cynin and MoinMoin as places for collective memory and
interaction, but definitively I feel more comfortable with web2py over
others and now I would like to share the documentation about this or
other things using, of course, web2py appliances and plugins, specially
plugin_wiki.

The problem is that my documentation is in ReStructuredText (ReST)
format, so I would like to know if there is a way to convert from ReST
to markmin or even better if there is a way to add several markup
languages to markmin (for example I would like to explore also
txt2tags[1]). Until now my search on the web is not helping me a lot,
except for Pandoc, but it has no support for markmin.

Thanks,

Offray

[1] http://txt2tags.org/markup.html
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNONkhAAoJEGiex2828ICwgUEIAI+Aj/XTFiRX6Jdl5weC/8GV
5Fu2mji2sL6sdBoYHBIiG7y8wp3vgh7MfXIQlD+iD24kg+80oCH+7i2Stdv9lgoj
cFilgVmFlCpU7VL/5jpH3uKIJ1duB7kMkZUmM1euyJWNPD+zNV6iSOG27D0EvC4p
5bZ35K7884HTaxsJRPKu54WJ+asZWz3bhQzI5qwaZsrfw6Nu/vVnXaYjvC4hQ9O4
8FL4jKRb4IdE0q+24i9Rs2aGCRMszf4Yda4YgHzaCUguyELicv2PmkgzTFvLeciN
cWcxQcn4dZGJHmjkEBq482ZmtmrzdJiGvpcDMuegrf6nRRsyjIA4PwNiZ4nW8tA=
=2EZ8
-END PGP SIGNATURE-


Re: [web2py] Re: SQLFORM not working on GAE

2011-01-20 Thread Tito Garrido
db.define_table('jogo',
Field('nome',requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db, 'jogo.nome')]),
Field('console',requires=IS_IN_SET(['PS3','Xbox','Wii'])),
Field('descricao','text',requires=IS_NOT_EMPTY()),
Field('foto','upload',autodelete=True, label='Capa'),
Field('youtube_link',requires=IS_EMPTY_OR(IS_URL()), readable=False,
writable=False),
Field('aprovado', 'boolean', default=False),
format='%(nome)s - %(console)s')

No exception message, there is no error, it just doesn't add any entry to
db. (only happening on GAE)

On Thu, Jan 20, 2011 at 8:32 PM, Martin.Mulone mulone.mar...@gmail.comwrote:

 db definition?.
 exception message?.





-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


[web2py] Re: Should I store miscellaneous user data in auth_user?

2011-01-20 Thread howesc
i agree with brunounless you are running on GAE.  in that case join's 
are not supported and are implemented as additional queries under the 
covers.  in the GAE case i extend my auth table so that i don't have to run 
so many queries.

db[auth.settings.table_user_name] is better than db.auth_user so that if you 
change the name of the auth_user table using the settings it will change 
here as well.  prior to GAE namespaces i was changing the names of tables so 
they would not overlap between applications.

cfh



[web2py] Re: Using mysqldb instead of pymysql

2011-01-20 Thread drayco
Hi, I did my test with trunk version

this is the issue

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
16, in module
migrate = False)
  File /home/drayco/web2py/gluon/dal.py, line 3457, in define_table
sequence_name=sequence_name))
  File /home/drayco/web2py/gluon/dal.py, line 3741, in __init__
primarykey must be a list of fields from table '%s  % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

On Jan 18, 9:50 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I just included the latest pymysql in trunk. Does it make things
 better?

 On Jan 18, 6:05 pm, drayco antrod...@gmail.com wrote:

  Hi, I do this revert, thank's

  try:
      import MySQLdb
      drivers.append('MySQL')
  except ImportError:
      logger.debug('no MySQLdb driver')

  And

          self.pool_connection(lambda db=db,
                               user=credential_decoder(user),
                               password=credential_decoder(password),
                               host=host,
                               port=port,
                               charset=charset:
  MySQLdb.Connection(db=db,

  user=user,

  passwd=password,

  host=host,

  port=port,

  charset=charset,
                                                                ))
  In dal.py
  However, the error is still appear

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
  16, in module
      migrate = False)
    File /home/drayco/web2py/gluon/dal.py, line 3457, in define_table
      sequence_name=sequence_name))
    File /home/drayco/web2py/gluon/dal.py, line 3741, in __init__
      primarykey must be a list of fields from table '%s  % tablename
  SyntaxError: primarykey must be a list of fields from table
  'med_dnpmst_4

  Well I think this is a problem with compatibility.

  Do you have any suggestions?

  On Jan 14, 6:36 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:

   To test if the issue is with pymysql, you could edit the dal file to
   use mysqldb

  http://code.google.com/p/web2py/source/diff?spec=svnfc75444ca55590835...

   On Jan 13, 11:31 am, drayco antrod...@gmail.com wrote:

I need that some of you guys check this, in my case, Pymysql have some
issues with legacy databases (First, I think this issue is of new dal,
but I'm not sure)
However mysqldb, my application work well

this is my report:

   http://groups.google.com/group/web2py/browse_thread/thread/72e91e281e...

On Jan 12, 11:46 am, Vasile Ermicioi elff...@gmail.com wrote:

 hi,

 Massimo, there is a new  version of pymysql

 I think pymysql has a few advantages
 - being pure Python, PyMySQL is easily patched by gevent and the 
 likes to
 make it cooperative

http://code.google.com/p/pymysql/wiki/WhyPyMySQL

 I use it with web2py and works fine




[web2py] index called twice

2011-01-20 Thread Art Zemon

Hello,

I have a simple function in a controller and it seems to be getting 
called twice. Any ideas why, and what to do about it?


   def index():
try:
rows = db(  (db.gtsign.auth_user_id==request.vars['c']) \
(db.gtsign.id==request.vars['s']) \
(db.gtsign.auth_user_id==db.auth_user.id)).select()
auth_user=rows.first().auth_user
gtsign=rows.first().gtsign
pattern = re.compile(r'[^\d]')
phoneDigits = pattern.sub('', auth_user.telephone)

use_count = gtsign.use_count + 1
db.gtsign[gtsign.id] = dict(use_count=use_count)

return dict(gtsign=gtsign, auth_user=auth_user,
   phoneDigits=phoneDigits)
except Exception, err:
redirect(URL('invalid'))

The symptom is that gtsign.use_count is going up by 2 instead of by 1 
every time the page is loaded from a mobile phone. I see this in the 
Apache log file:


   97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] GET
   //gotosigns/?c=1s=19 HTTP/1.1 200 1500 - Mozilla/5.0 (Linux; U;
   Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
   AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17

   97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] HEAD
   //gotosigns/?c=1s=19 HTTP/1.1 200 590 - Mozilla/5.0 (Linux; U;
   Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
   AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17


I am running web2py Version 1.91.6 (2011-01-03 17:55:14) on Linux and 
Apache with mod_wsgi.


Thanks,
-- Art Z.


[web2py] Re: pyQT web2py

2011-01-20 Thread blackthorne
well, I think he didn't made it clear but I see many ways:

- create a component for web2py that instead of generating the html/
css/js source you use to see it in a website, it would generate the
GUI application (controllers+view) as well as linking it to a shared
model. This is a lot of work but would be awesome...

- create an independent app that communicate with web2py just like you
mentioned.

- bind a Qt interface to the same hooks currently used by the web
interface that allows you to do pretty much everything web2py
supports. One idea would be to put the admin application with a native
look and extend, in example, monitoring properties (graphs, stats,
plots). Qt is good for that.

- web 6.0 - my idea (not so web2py specific, but appliable)

best regards

On Jan 21, 12:03 am, Stefaan Himpe stefaan.hi...@gmail.com wrote:
 Hello,

 It's not clear to me how you would combine PyQt (or PySide) with web2py
 in the same application, it doesn't seem to make much sense to me.

 Provided you could actually make this work, a PyQt UI embedded in a
 web2py application would only be visible on the server (e.g. some google
 data center), not on the client (user of the web application).

 Of course I could have misunderstood: you could make a PyQt UI that
 requests services from a web2py web application using xmlrpc.
 In that case both applications are completely separate from each other.

 If you want to make both a web and desktop version of the same
 application (e.g. a bug database that can run both in your web browser,
 or as a standalone desktop program), perhaps pyjamas is something worth
 looking at:http://pyjs.org/

 Best regards,
 Stefaan.


[web2py] get_or_create() for Web2py?

2011-01-20 Thread dominatus
I have a table in one of my models that I am trying to either create
or update based on the current date when the user logs in.  I noticed
there is no explainable way to check if a current record exists in a
model from within a controller function.  Do we have to use:

crud.create(db.schedule) or crud.update(db.schedule,
db.schedule((auth.user.id == db.schedule.user)) 
(db.schedule.todays_date == datetime.date.time())).select(id)

In Django there is simply a get_or_create() function to perform this
task.  Just wondering if this is the right way of going about it.
Thanks.


[web2py] Re: index called twice

2011-01-20 Thread Massimo Di Pierro
Look in the view for an incorrect link like

img src=xxx/

if it is a relavive url it would actually call /app/default/index/xxx
and index is called twice.

On Jan 20, 8:44 pm, Art Zemon a...@hens-teeth.net wrote:
 Hello,

 I have a simple function in a controller and it seems to be getting
 called twice. Any ideas why, and what to do about it?

     def index():
          try:
              rows = db(  (db.gtsign.auth_user_id==request.vars['c']) \
      (db.gtsign.id==request.vars['s']) \
      (db.gtsign.auth_user_id==db.auth_user.id)).select()
              auth_user=rows.first().auth_user
              gtsign=rows.first().gtsign
              pattern = re.compile(r'[^\d]')
              phoneDigits = pattern.sub('', auth_user.telephone)

              use_count = gtsign.use_count + 1
              db.gtsign[gtsign.id] = dict(use_count=use_count)

              return dict(gtsign=gtsign, auth_user=auth_user,
     phoneDigits=phoneDigits)
          except Exception, err:
              redirect(URL('invalid'))

 The symptom is that gtsign.use_count is going up by 2 instead of by 1
 every time the page is loaded from a mobile phone. I see this in the
 Apache log file:

     97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] GET
     //gotosigns/?c=1s=19 HTTP/1.1 200 1500 - Mozilla/5.0 (Linux; U;
     Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
     AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17

     97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] HEAD
     //gotosigns/?c=1s=19 HTTP/1.1 200 590 - Mozilla/5.0 (Linux; U;
     Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
     AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17

 I am running web2py Version 1.91.6 (2011-01-03 17:55:14) on Linux and
 Apache with mod_wsgi.

 Thanks,
      -- Art Z.


[web2py] Re: get_or_create() for Web2py?

2011-01-20 Thread Massimo Di Pierro
what is the condition to decide whether is exists or not?

On Jan 20, 7:24 pm, dominatus ffly...@gmail.com wrote:
 I have a table in one of my models that I am trying to either create
 or update based on the current date when the user logs in.  I noticed
 there is no explainable way to check if a current record exists in a
 model from within a controller function.  Do we have to use:

 crud.create(db.schedule) or crud.update(db.schedule,
 db.schedule((auth.user.id == db.schedule.user)) 
 (db.schedule.todays_date == datetime.date.time())).select(id)

 In Django there is simply a get_or_create() function to perform this
 task.  Just wondering if this is the right way of going about it.
 Thanks.


[web2py] Re: Table of Contents for plugin_wiki pages

2011-01-20 Thread blackthorne
I found this awesome!

Please take a look until the final result:
http://www.jankoatwarpspeed.com/post/2009/08/20/Table-of-contents-using-jQuery.aspx

On Jan 17, 4:25 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 http://code.google.com/p/samaxesjs/wiki/TableOfContentsPlugin

 On Jan 17, 5:31 am, blackthorne francisco@gmail.com wrote:



  Something that might interest plugin_wiki users, is the possibility to
  automatically generate tables ofcontentsfrom a page based on
  headings and specially tagged divs.

  just put this on the page.html view of the plugin:
  {{extend 'layout.html'}}
  {{if page:}}
  {{if page.slug.startswith('meta-'):}}{{=CODE(page.body)}}{{else:}}
  {{import re}}{{from BeautifulSoup import BeautifulSoup}}
  {{content=plugin_wiki.render(page.body)}}
  {{soup = BeautifulSoup(str(content))}}
  {{toc = [(tag.name,tag.text) for tag in
  soup.findAll(name=re.compile(rh[1-3]))]}}{{pass}}

  now you have a list with a pair telling you the level of heading and
  its content so you can do things like this:
  div id=toc
  ul
  {{sublevel=0}}{{for index,(level,text) in enumerate(toc):}}{{if
  int(toc[index-1][0][1])  int(level[1]):}}{{sublevel+=1}}
  ul{{elif int(toc[index-1][0][1])  int(level[1]) and sublevel  0:}}
  {{sublevel-=1}}/ul{{pass}}
  li{{=text}}/li{{pass}}{{while sublevel  0:}}{{sublevel -=1}}/
  ul{{pass}}
  /ul
  /div
  {{=content}}

  This can easily be adapted to more generic situations. All you need is
  the html content of the page in a variable so that you can parse it
  for headings. You can adjust the depth of headings to be displayed by
  changing the regular expression h[1-3] to h[1-6] if you want 6...

  Next step: add anchors in headings so that we can link thetableof
 contentsinto it.

  Best regards


[web2py] python web2py.py stops any any comman

2011-01-20 Thread Martin Weissenboeck
Hi,

I have started web2py with the following command

python web2py.py ...


and I get:

web2py Enterprise Web Framework

use kill -SIGTERM 14688 to shudown the web2py server


and nothing more!
There is no prompt and I cann't input anything - seems it hangs.

Anyhow web2py works: I can access the server using the ip-address and port
8000

What shall I do?

Kind regards, Martin