[web2py] Re: Chapter 13: components and plugins

2010-08-03 Thread mdipierro
trunk.

On Aug 2, 7:07 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 The book is based on a specific version? are you using 1.81.5 or trunk?

 2010/8/2 mdipierro mdipie...@cs.depaul.edu



  Thank you Bruno,

  OK. I would like to have the images as tiff in actual size in pixels.
  Scale the window so that the default layout fits in the browser. I
  will cut it as needed.

  Massimo

  On Aug 2, 9:53 am, Bruno Rocha rochacbr...@gmail.com wrote:
   I can do for plugin_wiki chapter, as I am working a lot with that.

   let me know about standard format for the image and min-max size/scale, I
   use default MacOs screenshot tool ( shift+command+4)

   Do you want only selection of the funcionality?, zooming ?, just body
   content or including browser window?

   2010/8/2 mdipierro mdipie...@cs.depaul.edu

Can somebody help me make the screenshots for chapter 3 and chapter 13
within this week?
You can a free copy of the final PDF book before everybody else ;-)
Let me know if you can before you start doing it. No need to duplicate
work.

Massimo

On Aug 2, 9:22 am, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 Here is an early draft of the book chapter 13 which discusses
 Components, Plugins and plugin_wiki.

 It is incomplete. Screenshots are missing. It references the trunk
  code.

 Can you please read it and send me feedback?

 Massimo

  chap13.pdf
 249KViewDownload

   --

  http://rochacbruno.com.br

 --

 http://rochacbruno.com.br


[web2py] Re: markmin, t2, t3, cube9 etc. (important update)

2010-08-03 Thread mdipierro
This has been in trunk for some time:

 from gluon.html import markmin_serializer
 html='divh1Header/h1pa 
 href=http://google.com;link/abbold/b/div'
 TAG(html).flatten(markmin_serializer)
'#Header\n\n[[link http://google.com]]**bold**\n\n'

You can use it to convert markdown syntax:

 from gluon.contrib.markdown import WIKI
 md = '#Header\n\n[link](http://google.com)*bold*\n\n'
 TAG(WIKI(md).xml()).flatten(markmin_serializer)
#Header\n\n [[link http://google.com]]''bold''\n\n 






On Aug 3, 3:04 am, Timmie timmichel...@gmx-topmail.de wrote:
  Texy features are very goodhttp://texy.info/en/syntax
  but the syntax is ugly...

  I would like markmin to implement all that features in a beauty way.

 OK, but being able to convert text from other formats (HTML, ODF,
 wiki) into markmin would be good. Thus I suggest to lean on existing
 markup.


[web2py] Re: markmin, t2, t3, cube9 etc. (important update)

2010-08-03 Thread mdipierro
and the markitup js that ships with plugin_wiki has been modified to
support markmin too.

On Aug 3, 3:20 am, mdipierro mdipie...@cs.depaul.edu wrote:
 This has been in trunk for some time:

  from gluon.html import markmin_serializer
  html='divh1Header/h1pa 
  href=http://google.com;link/abbold/b/div'
  TAG(html).flatten(markmin_serializer)

 '#Header\n\n[[linkhttp://google.com]]**bold**\n\n'

 You can use it to convert markdown syntax:

  from gluon.contrib.markdown import WIKI
  md = '#Header\n\n[link](http://google.com)*bold*\n\n'
  TAG(WIKI(md).xml()).flatten(markmin_serializer)

 #Header\n\n [[linkhttp://google.com]]''bold''\n\n 

 On Aug 3, 3:04 am, Timmie timmichel...@gmx-topmail.de wrote:

   Texy features are very goodhttp://texy.info/en/syntax
   but the syntax is ugly...

   I would like markmin to implement all that features in a beauty way.

  OK, but being able to convert text from other formats (HTML, ODF,
  wiki) into markmin would be good. Thus I suggest to lean on existing
  markup.


[web2py] Re: code organization

2010-08-03 Thread Iceberg
Don't what you really want. In short, modules organize your functional
code, but you still need to expose them in your controller.

# In controllers/default.py
def index():
return {'': DIV( LOAD(url=URL(r=request, f='foo.load')) )}
def foo():
return {'': local_import('my_module').my_func()}

# In modules/my_module.py
def my_func():
return FORM(...)

Iceberg

On Aug 2, 10:19 pm, Miguel Lopes mig.e.lo...@gmail.com wrote:
 yes I've tried it. local_import does not work. the LOAD function signature
 expects a controller name and function name (defaulting to the
 request.application), as far as I know it is not possible to pass it a
 function - at least supplying it a function object does not work.

 Miguel



 On Mon, Aug 2, 2010 at 2:51 PM, Bruno Rocha rochacbr...@gmail.com wrote:
  Have you tried local_import()?
  I really dont know if that will work in your case, Give it a try

 http://web2py.com/book/default/chapter/04?search=local_import

  2010/8/2 Miguel Lopes mig.e.lo...@gmail.com

  I have several functions returning forms in a module file, and started
  experimenting with the LOAD function, but I can figure out how to use this
  functions without moving them to the controller. I would prefer to keep
  these functions in a module for code organization reasons. I wonder if it 
  is
  possible, and if not what solution do you use for code organization?

  Miguel

  --

 http://rochacbruno.com.br


[web2py] Re: JSON from rows

2010-08-03 Thread PanosJee
Well .json is what i was doing but rows.as_list() and row.as_dict()
will do the trick ;-)

On Aug 1, 11:56 pm, PanosJee panos...@gmail.com wrote:
 thanx massimo
 as for question one i think i use action.jsonbut i ll dig a little
 bit deeper into that

 On Aug 1, 4:40 pm, mdipierro mdipie...@cs.depaul.edu wrote:



  On Aug 1, 4:47 am, PanosJee panos...@gmail.com wrote:

   Hello everyone, i have 2 small questions regardingJSON.

   Question1
   I use @service.jsonto return aJSONresponse to an ajax call with
   some rows but besides the data I also get some lambdas that are
   attached to Rows. Is there any to get rid of those?

  Don't use @service.json. Just call the action withhttp://action.json

   Question 2
   Is it also possible to return rows injsonformat inside a normal html
   response.

  yes.

  {{=XML(entries.json())}}

   For example i want to return a simple HTML page and output something
   like this in my code
   script type='script/javascript'
   var entries = {{ entries }};
   /script

   where entries is the result of a DAL query


Re: [web2py] Re: Getting Eclipse / Pydev running

2010-08-03 Thread Phyo Arkar
Import web2py directly from mercurial repo.

For me , THis work flawlessly

www.web2pyslices.com/main/slices/take_slice/2

http://www.web2pyslices.com/main/slices/take_slice/2all completions ,
debugging works. just paste your application inside it .

On Tue, Aug 3, 2010 at 8:11 AM, pabloest pab...@gmail.com wrote:

 Thank you for the extended description.
 This is almost exactly what I had been following. I had skipped the
 arguments partially because I think Eclipse is not taking them. When I
 enter the arguments and then go to the interpreter tab to see
 resulting command line for the given parameters (button), they do not
 appear. Other commands do appear, but not what I've entered into the
 arguments tab.  Do yours appear there?

 Aptana gave the same behavior as Eclipse, but I'm not surprised.

 I might try re-downloading web2py's source - perhaps something got
 corrupted.

 Pablo

 On Aug 2, 5:54 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
  Here's my naif setup - note that this should be exactly the same for
 Eclipse
  or Aptana (Aptana is Eclipse + goodies):
 
  1. Use web2py source.
  2. Make sure you have PyDev installed in Eclipse/Aptana.
  3. Create a project a PyDev project:
* this will link to the web2py folder on the file system - so you will
  have access to all projects and the web2py installation
* I call this project web2py_projects
* (if you know what a perspective is in Eclipse, you can use either
 Aptana
  or PyDev perspectives - it's irrelevant).
  4. Create a link to the web2py folder in the project: just create a
 folder
  and use the Advanced  button to link to the web2py folder in the file
  system
 
  Know you are ready to go!
  In general I either duplicate an existing project directly from the file
  view in the IDE or I use the web2py web interface to do it.
  Note that if you change any web2py files from outside of Eclipse, then
 you
  will have to refresh the project so that the file structure is re-read.
 This
  can be done by selecting the project in the File View and pressing F5.
 
  Debugging with PyDev:
  Since we are in development I always run web2py in PyDev's debugging mode
  1. Run we2py regularly, set an admin password and stop the server. This
 is
  just so you have a password set in web2py for admin access
  2. Open the web2py.py file
  3. Select Debug | Debug configurations - under Python Run create a new
  configuration, name it: Run web2py (or something useful):
 * In the Main tab: select the web2py_projects as the Project and
 select
  the web2py.py file as the Main Module
 * Click Apply
 * In the Arguments tab type (without the curly braces):  {-p 8080 -a
  recycle}  this will avoid the dialog for starting web2py and will run
 on
  port 8080 with the last password used (you must have set an admin
 password
  previously)
 * Some of the other tabs may be useful, e.g. setting the interpreter
  4. When ready click Debug, and presto web2py is running in PyDev's
 debug
  mode
  5. When you wish to debug some code just double click, or right-click
 on
  the code editors left margin to set break points. PyDev will
 automatically
  launch the debug perspective.
 
  BTW If you search you can find some info on getting code completion to
 work
  (I have not yet bothered).
 
  HTH,
  Miguel
 
 
 
  On Mon, Aug 2, 2010 at 6:04 AM, pabloest pab...@gmail.com wrote:
   Thanks, Christopher and Miguel.
 
   I will try a different port.
   Actually on Wing I started to get a similar error about nothing
   listening (and then an exit). But this was after the web2py pop-up
   where I can enter the port.
   I had just read your replies so I tried port 8080 and that did it.
   Thank you!
 
   I tried again on Eclipse but it won't even get to the point of
   bringing up the web2py window where I can set the port.
 
   I will try Aptana - I believe I already downloaded it.
 
   Pablo



[web2py] How to detect in controller that request is via AJAX?

2010-08-03 Thread David Marko
How to detect in controller that request is via AJAX?

David


[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread mdipierro
Done. please check it.

On Aug 1, 2:03 am, Bruno Rocha rochacbr...@gmail.com wrote:
 One more suggestion for today.

 It will be great to create new pages from template, as creating a template
 page with standard texts, widgets and other stuff, we have any way to
 duplicate that page.

 actually just creating a way to duplicate certain page will do that work.

 {{=thanks}}

 2010/8/1 Bruno Rocha rochacbr...@gmail.com



  But the .code thing, is usefull for editors, so there is a way to .code
  output be available only to logged in editor users?

  its usefull to check the code as in
 http://web2pybrasil.appspot.com/cursoweb2py/plugin_wiki/page.code/met...

  2010/8/1 Bruno Rocha rochacbr...@gmail.com

  I Just found one more thing:

  take this page by example:

 http://web2pybrasil.appspot.com/cursoweb2py/plugin_wiki/page/curso-we...

  now add a .code to he action

 http://web2pybrasil.appspot.com/cursoweb2py/plugin_wiki/page.code/cur...

  even logged out, you can see the code behind the page, as we pass
  parameters to custom widgets, I think this could not happens.

  but, it is usefull to still have page.load, page.xml, page.json, and
  page.rss functions.

  2010/8/1 Bruno Rocha rochacbr...@gmail.com

  I am developing and writing a lot with plugin_wiki (cube2py). I already
  have some suggestions, observations and have also found some bugs.
  As I'm finding more issues, I will posting here in this thread. If
  someone else has something to add, enjoy the thread.

  I am working now on this page :
 http://web2pybrasil.appspot.com/cursoweb2py/

  *
  *
  *Bugs I Found:*

  -* **Comments Widget*
  I noticed that the comments widget is restricted to logged in users, the
  code that generates the widget has requires_login (), this is great for
  protecting users not logged in to write.
  however, as the same widget generates the form for adding a comment, and
  also generates a list of comments to display, it is not possible to 
  display
  existing comments to a user who is not logged.
  I suggest dividing into two widgets, one to generate the form of
  insertion, and this would be protected. And another to generate a list
  of existing comments, and this would free reading. this last could be used
  in another place eg:  to show recent comments for a page.

  -* Searches with crud.search and jqgrid on GAE*
  I got error using crud.search and jqgrid widgets, as GAE does not allow
  to perform LIKE, StartsWIth, EndsWith, Contains, etc, while do not have 
  any
  workarround, I think that options should be disabled When it is detected
  that is working in GAE

  *Suggestions:*( Too many things. Sorry )

  - *Widget_Builder:*
  Binds the code generated by widget builder direct to the page content
  editor, I think it is not hard to do with JavaScript, preventing the
  copy-paste when using widget builder

  - *Widget* *Messages customization*
  Include the total capacity for customize the output messages  in the
  standard widgets. load_action and load_url eg uses AJAX and display
  the message loading, it would be nice to have how to pass as a 
  parameter,
  a new message to be displayed, it is usefull for translating.

  - *Blank lines, white space:*
  Markdown for example set spaces by using two blank spaces at the end of
  each line to make a break, I'm developing a lot with plugin_wiki and had 
  to
  create a function just to give me white space and blank lines.
  ``{{=br(2)}}``:template

  - *Categories:*
  wiki or any other type of page created with plugin_wiki, IMHO, will need
  some kind of category management. it is not difficult to implement as
  standard, without having to create custom widgets, as I had to do.

  - *Search: *
  I created a custom widget that performs searches in titles, slugs, and
  body of the pages, and it is running on GAE,  I believe this should be 
  used
  as a widget placed on the meta-header, or meta-sidebar for example. but
  could be part of the plugin itself, considering that this is a basic need 
  of
  any wiki page.

  - *Link Targets:*
  I do not think there is a specific reason not to open external links in a
  wiki page, wikipedia does, it would be interesting to receive the 
  parameter
  target by default in the marking of a [[link]] as [[linktitle
 http://linkurl blank]]

  - *Preview and Saving: *
  It is very annoying having to submit  the page every time we need to
  save, then to have a preview, the saving could happen with AJAX and have
  option to view a Preview window.

  - *Lists:*
   In ordered and unordered lists creates with - and +, Needs a way to
  create sublevels with lists, maybe -- and ++
  - A Topic
  -- Subtopic of A Topic
  --- Subtopic of a subtopic of A Topic
  -- Another subtopic of A Topic

  + A Topic
  ++ Subtopic of A Topic
  +++ Subtopic of a subtopic of A Topic
  ++ Another subtopic of A Topic

  - *Page auto reference:*
  It would be interesting to have a variable that works as ALIAS to
  reference the page itself, when I 

[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread mdipierro
``
name: comment
table: [page]
record_id: 1
``:comment

not sure this is a good idea but for now it should work.

On Aug 1, 9:33 am, rochacbruno rochacbr...@gmail.com wrote:
 I mean that THISPAGE should be a shortcut to {{=request.args(0)}}

 THISPAGE =  '{{=request.args(0)}}'

 
 name: comments
 table: THISPAGE
 record_id: 1
 :comments

 or

 
 {{=THISPAGE}}
 :template

 Sent from my iPhone

 On 01/08/2010, at 05:40, qqsaqq sla...@gmx.net wrote:

  Concerning Your THISPAGE idea:

  I think what You mean can be achieved simply by writing
  [[this page #]]
  I tried it, works great.

  On Aug 1, 6:54 am, Bruno Rocha rochacbr...@gmail.com wrote:
  I am developing and writing a lot with plugin_wiki (cube2py). I already 
  have
  some suggestions, observations and have also found some bugs.
  As I'm finding more issues, I will posting here in this thread. If someone
  else has something to add, enjoy the thread.

  I am working now on this page :http://web2pybrasil.appspot.com/cursoweb2py/

  *
  *
  *Bugs I Found:*

  -* **Comments Widget*
  I noticed that the comments widget is restricted to logged in users, the
  code that generates the widget has requires_login (), this is great for
  protecting users not logged in to write.
  however, as the same widget generates the form for adding a comment, and
  also generates a list of comments to display, it is not possible to display
  existing comments to a user who is not logged.
  I suggest dividing into two widgets, one to generate the form of insertion,
  and this would be protected. And another to generate a list of existing
  comments, and this would free reading. this last could be used in another
  place eg:  to show recent comments for a page.

  -* Searches with crud.search and jqgrid on GAE*
  I got error using crud.search and jqgrid widgets, as GAE does not allow to
  perform LIKE, StartsWIth, EndsWith, Contains, etc, while do not have any
  workarround, I think that options should be disabled When it is detected
  that is working in GAE

  *Suggestions:*( Too many things. Sorry )

  - *Widget_Builder:*
  Binds the code generated by widget builder direct to the page content
  editor, I think it is not hard to do with JavaScript, preventing the
  copy-paste when using widget builder

  - *Widget* *Messages customization*
  Include the total capacity for customize the output messages  in the
  standard widgets. load_action and load_url eg uses AJAX and display the
  message loading, it would be nice to have how to pass as a parameter, a
  new message to be displayed, it is usefull for translating.

  - *Blank lines, white space:*
  Markdown for example set spaces by using two blank spaces at the end of 
  each
  line to make a break, I'm developing a lot with plugin_wiki and had to
  create a function just to give me white space and blank lines.
  ``{{=br(2)}}``:template

  - *Categories:*
  wiki or any other type of page created with plugin_wiki, IMHO, will need
  some kind of category management. it is not difficult to implement as
  standard, without having to create custom widgets, as I had to do.

  - *Search: *
  I created a custom widget that performs searches in titles, slugs, and body
  of the pages, and it is running on GAE,  I believe this should be used as a
  widget placed on the meta-header, or meta-sidebar for example. but could be
  part of the plugin itself, considering that this is a basic need of any 
  wiki
  page.

  - *Link Targets:*
  I do not think there is a specific reason not to open external links in a
  wiki page, wikipedia does, it would be interesting to receive the parameter
  target by default in the marking of a [[link]] as 
  [[linktitlehttp://linkurlblank]]

  - *Preview and Saving: *
  It is very annoying having to submit  the page every time we need to save,
  then to have a preview, the saving could happen with AJAX and have option 
  to
  view a Preview window.

  - *Lists:*
   In ordered and unordered lists creates with - and +, Needs a way to create
  sublevels with lists, maybe -- and ++
  - A Topic
  -- Subtopic of A Topic
  --- Subtopic of a subtopic of A Topic
  -- Another subtopic of A Topic

  + A Topic
  ++ Subtopic of A Topic
  +++ Subtopic of a subtopic of A Topic
  ++ Another subtopic of A Topic

  - *Page auto reference:*
  It would be interesting to have a variable that works as ALIAS to reference
  the page itself, when I need to reference the current page into a widget I
  use {{= request.args(0)}} would be more interesting to use something like
  THISPAGE

  - *Wiki Pages management: *
  Wiki Pages management plugin_wiki / index tends to get a little confusing
  as the number of existing pages grows, it would be interesting to have
  pagination, search, categorization.

  - *Meta Pages: *
  As a developer I use a lot the page meta-code, but as the code grows, 
  things
  start getting difficult to administer, would have the option to create more
  pages like meta-code, for example meta-code- xxx, 

[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread mdipierro
fixed too. This was a markmin bug.

On Aug 2, 8:23 am, Bruno Rocha rochacbr...@gmail.com wrote:
 Another BUG in markmin render

 paragraph with **bold**, ''italic'' and ``code``.but:

 **text** renders as btext/b

 **text:** renders as p**text:**/p

 the same happens if we put any mark, point or accent as the last in Markup

 **text()** renders as p**text()**/p

 where should render as btext()/b

 2010/8/2 Bruno Rocha rochacbr...@gmail.com



  Error on select widget, trying to fetch non UTF-8 text records, People 
  wrote a message in portuguese, a lot of accents, [ á, é, ã, ê, í] , to 
  insert with createwidget no problem, then I can view the records on GAE 
  admin.

  But when I try to select the accentuated records with  selectwidget its 
  raise an error:

  the same occurs when I give accentuated totle for a page, inserts ok, 
  select fails.

  Traceback (most recent call last):

    File 
  /base/data/home/apps/web2pybrasil/4.343788305571582046/applications/init/models/plugin_wiki.py,
   line 555, in render_widget
      html = getattr(PluginWikiWidgets,name)(**args)
    File 
  /base/data/home/apps/web2pybrasil/4.343788305571582046/applications/init/models/plugin_wiki.py,
   line 252, in jqgrid
      columns = [x.strip() for x in db[table].fields if 
  db[table][x.strip()].readable]
    File 
  /base/data/home/apps/web2pybrasil/4.343788305571582046/gluon/sql.py, line 
  1323, in __getitem__
      return dict.__getitem__(self, str(key))
  KeyError: 'contato'

  2010/8/1 Bruno Rocha rochacbr...@gmail.com

  SlideShow widget also does not runs on GAE.

  try it;http://web2pybrasil.appspot.com/init/plugin_wiki/page/images

  the code:
 http://web2pybrasil.appspot.com/init/plugin_wiki/page.code/images

  Given an image saved as BLOB in GAE, how to retrieve this image URL to put
  it on Wiki Page body?

  2010/8/1 Bruno Rocha rochacbr...@gmail.com

  Page Attachments does not works on GAE

  2010/8/1 Bruno Rocha rochacbr...@gmail.com

  I am developing and writing a lot with plugin_wiki (cube2py). I already
  have some suggestions, observations and have also found some bugs.
  As I'm finding more issues, I will posting here in this thread. If
  someone else has something to add, enjoy the thread.

  I am working now on this page :
 http://web2pybrasil.appspot.com/cursoweb2py/

  *
  *
  *Bugs I Found:*

  -* **Comments Widget*
  I noticed that the comments widget is restricted to logged in users, the
  code that generates the widget has requires_login (), this is great for
  protecting users not logged in to write.
  however, as the same widget generates the form for adding a comment, and
  also generates a list of comments to display, it is not possible to 
  display
  existing comments to a user who is not logged.
  I suggest dividing into two widgets, one to generate the form of
  insertion, and this would be protected. And another to generate a list
  of existing comments, and this would free reading. this last could be 
  used
  in another place eg:  to show recent comments for a page.

  -* Searches with crud.search and jqgrid on GAE*
  I got error using crud.search and jqgrid widgets, as GAE does not allow
  to perform LIKE, StartsWIth, EndsWith, Contains, etc, while do not have 
  any
  workarround, I think that options should be disabled When it is
  detected that is working in GAE

  *Suggestions:*( Too many things. Sorry )

  - *Widget_Builder:*
  Binds the code generated by widget builder direct to the page content
  editor, I think it is not hard to do with JavaScript, preventing the
  copy-paste when using widget builder

  - *Widget* *Messages customization*
  Include the total capacity for customize the output messages  in the
  standard widgets. load_action and load_url eg uses AJAX and display
  the message loading, it would be nice to have how to pass as a 
  parameter,
  a new message to be displayed, it is usefull for translating.

  - *Blank lines, white space:*
  Markdown for example set spaces by using two blank spaces at the end of
  each line to make a break, I'm developing a lot with plugin_wiki and had 
  to
  create a function just to give me white space and blank lines.
  ``{{=br(2)}}``:template

  - *Categories:*
  wiki or any other type of page created with plugin_wiki, IMHO, will need
  some kind of category management. it is not difficult to implement as
  standard, without having to create custom widgets, as I had to do.

  - *Search: *
  I created a custom widget that performs searches in titles, slugs, and
  body of the pages, and it is running on GAE,  I believe this should be 
  used
  as a widget placed on the meta-header, or meta-sidebar for example. but
  could be part of the plugin itself, considering that this is a basic 
  need of
  any wiki page.

  - *Link Targets:*
  I do not think there is a specific reason not to open external links in
  a wiki page, wikipedia does, it would be interesting to receive the
  parameter target by default in the 

[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread mdipierro
I am not convinced this is a good idea.

On Aug 2, 2:11 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Another suggestion:

 title/title should be the page.title field of plugin_wiki_page just
 including response.title = page.title to page controller

 def page():
     
     shows a page
     
     slug = request.args(0) or 'index'
     w = db.plugin_wiki_page
     page = db(w.slug==slug).select().first()
     response.title = page.title
     if not auth.user and (not page or not page.public or not page.active):
         redirect(URL(r=request,c='default',f='user',args='login'))
     elif not plugin_wiki_editor and (not page or not page.public or not
 page.active):
         raise HTTP(404)
     elif page and page.role and not auth.has_membership(page.role):
         raise HTTP(404)
     if request.extension=='load': return plugin_wiki.render(page.body)
     if request.extension!='html': return page.body
     return dict(page=page,slug=slug)

 2010/8/1 Bruno Rocha rochacbr...@gmail.com



  I am developing and writing a lot with plugin_wiki (cube2py). I already
  have some suggestions, observations and have also found some bugs.
  As I'm finding more issues, I will posting here in this thread. If someone
  else has something to add, enjoy the thread.

  I am working now on this page :
 http://web2pybrasil.appspot.com/cursoweb2py/

  *
  *
  *Bugs I Found:*

  -* **Comments Widget*
  I noticed that the comments widget is restricted to logged in users, the
  code that generates the widget has requires_login (), this is great for
  protecting users not logged in to write.
  however, as the same widget generates the form for adding a comment, and
  also generates a list of comments to display, it is not possible to display
  existing comments to a user who is not logged.
  I suggest dividing into two widgets, one to generate the form of insertion,
  and this would be protected. And another to generate a list of existing
  comments, and this would free reading. this last could be used in another
  place eg:  to show recent comments for a page.

  -* Searches with crud.search and jqgrid on GAE*
  I got error using crud.search and jqgrid widgets, as GAE does not allow to
  perform LIKE, StartsWIth, EndsWith, Contains, etc, while do not have any
  workarround, I think that options should be disabled When it is detected
  that is working in GAE

  *Suggestions:*( Too many things. Sorry )

  - *Widget_Builder:*
  Binds the code generated by widget builder direct to the page content
  editor, I think it is not hard to do with JavaScript, preventing the
  copy-paste when using widget builder

  - *Widget* *Messages customization*
  Include the total capacity for customize the output messages  in the
  standard widgets. load_action and load_url eg uses AJAX and display
  the message loading, it would be nice to have how to pass as a parameter,
  a new message to be displayed, it is usefull for translating.

  - *Blank lines, white space:*
  Markdown for example set spaces by using two blank spaces at the end of
  each line to make a break, I'm developing a lot with plugin_wiki and had to
  create a function just to give me white space and blank lines.
  ``{{=br(2)}}``:template

  - *Categories:*
  wiki or any other type of page created with plugin_wiki, IMHO, will need
  some kind of category management. it is not difficult to implement as
  standard, without having to create custom widgets, as I had to do.

  - *Search: *
  I created a custom widget that performs searches in titles, slugs, and body
  of the pages, and it is running on GAE,  I believe this should be used as a
  widget placed on the meta-header, or meta-sidebar for example. but could
  be part of the plugin itself, considering that this is a basic need of any
  wiki page.

  - *Link Targets:*
  I do not think there is a specific reason not to open external links in a
  wiki page, wikipedia does, it would be interesting to receive the parameter
  target by default in the marking of a [[link]] as [[linktitle
 http://linkurl blank]]

  - *Preview and Saving: *
  It is very annoying having to submit  the page every time we need to save,
  then to have a preview, the saving could happen with AJAX and have option to
  view a Preview window.

  - *Lists:*
   In ordered and unordered lists creates with - and +, Needs a way to create
  sublevels with lists, maybe -- and ++
  - A Topic
  -- Subtopic of A Topic
  --- Subtopic of a subtopic of A Topic
  -- Another subtopic of A Topic

  + A Topic
  ++ Subtopic of A Topic
  +++ Subtopic of a subtopic of A Topic
  ++ Another subtopic of A Topic

  - *Page auto reference:*
  It would be interesting to have a variable that works as ALIAS to reference
  the page itself, when I need to reference the current page into a widget I
  use {{= request.args(0)}} would be more interesting to use something like
  THISPAGE

  - *Wiki Pages management: *
  Wiki Pages management plugin_wiki / index tends to get a little confusing
  

[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread mdipierro
I never though somebody sould have more than 1000 revisions. Let's
think about a good solution. The one you propose may be ok.

On Aug 2, 3:54 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 - Page History
 page history does not works on 
 GAE,http://web2pybrasil.appspot.com/init/plugin_wiki/page_history/home Fails
 and raises a ticket

 There is a limit to history entries per page?

 I mean, if I edit a page too many times this will create too many entries in
 plugin_wiki_page_history
 I think it needs a limit, may be 20 entries per page like a FIFO

 2010/8/1 Bruno Rocha rochacbr...@gmail.com



  I am developing and writing a lot with plugin_wiki (cube2py). I already
  have some suggestions, observations and have also found some bugs.
  As I'm finding more issues, I will posting here in this thread. If someone
  else has something to add, enjoy the thread.

  I am working now on this page :
 http://web2pybrasil.appspot.com/cursoweb2py/

  *
  *
  *Bugs I Found:*

  -* **Comments Widget*
  I noticed that the comments widget is restricted to logged in users, the
  code that generates the widget has requires_login (), this is great for
  protecting users not logged in to write.
  however, as the same widget generates the form for adding a comment, and
  also generates a list of comments to display, it is not possible to display
  existing comments to a user who is not logged.
  I suggest dividing into two widgets, one to generate the form of insertion,
  and this would be protected. And another to generate a list of existing
  comments, and this would free reading. this last could be used in another
  place eg:  to show recent comments for a page.

  -* Searches with crud.search and jqgrid on GAE*
  I got error using crud.search and jqgrid widgets, as GAE does not allow to
  perform LIKE, StartsWIth, EndsWith, Contains, etc, while do not have any
  workarround, I think that options should be disabled When it is detected
  that is working in GAE

  *Suggestions:*( Too many things. Sorry )

  - *Widget_Builder:*
  Binds the code generated by widget builder direct to the page content
  editor, I think it is not hard to do with JavaScript, preventing the
  copy-paste when using widget builder

  - *Widget* *Messages customization*
  Include the total capacity for customize the output messages  in the
  standard widgets. load_action and load_url eg uses AJAX and display
  the message loading, it would be nice to have how to pass as a parameter,
  a new message to be displayed, it is usefull for translating.

  - *Blank lines, white space:*
  Markdown for example set spaces by using two blank spaces at the end of
  each line to make a break, I'm developing a lot with plugin_wiki and had to
  create a function just to give me white space and blank lines.
  ``{{=br(2)}}``:template

  - *Categories:*
  wiki or any other type of page created with plugin_wiki, IMHO, will need
  some kind of category management. it is not difficult to implement as
  standard, without having to create custom widgets, as I had to do.

  - *Search: *
  I created a custom widget that performs searches in titles, slugs, and body
  of the pages, and it is running on GAE,  I believe this should be used as a
  widget placed on the meta-header, or meta-sidebar for example. but could
  be part of the plugin itself, considering that this is a basic need of any
  wiki page.

  - *Link Targets:*
  I do not think there is a specific reason not to open external links in a
  wiki page, wikipedia does, it would be interesting to receive the parameter
  target by default in the marking of a [[link]] as [[linktitle
 http://linkurl blank]]

  - *Preview and Saving: *
  It is very annoying having to submit  the page every time we need to save,
  then to have a preview, the saving could happen with AJAX and have option to
  view a Preview window.

  - *Lists:*
   In ordered and unordered lists creates with - and +, Needs a way to create
  sublevels with lists, maybe -- and ++
  - A Topic
  -- Subtopic of A Topic
  --- Subtopic of a subtopic of A Topic
  -- Another subtopic of A Topic

  + A Topic
  ++ Subtopic of A Topic
  +++ Subtopic of a subtopic of A Topic
  ++ Another subtopic of A Topic

  - *Page auto reference:*
  It would be interesting to have a variable that works as ALIAS to reference
  the page itself, when I need to reference the current page into a widget I
  use {{= request.args(0)}} would be more interesting to use something like
  THISPAGE

  - *Wiki Pages management: *
  Wiki Pages management plugin_wiki / index tends to get a little confusing
  as the number of existing pages grows, it would be interesting to have
  pagination, search, categorization.

  - *Meta Pages: *
  As a developer I use a lot the page meta-code, but as the code grows,
  things start getting difficult to administer, would have the option to
  create more pages like meta-code, for example meta-code- xxx,
  meta-code-something, meta-code-anynameigive, and they have 

[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread mdipierro
If it is done by the LOAD() then there should be a

request.env.http_web2py_component_location != None

Massimo


On Aug 3, 5:00 am, David Marko dma...@tiscali.cz wrote:
 How to detect in controller that request is via AJAX?

 David


[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread David Marko
I dont use LOAD, I simply call controller function from browser using
jQUERY $(#ID).load(URL to controller function) and in controller i
have to detect this ajax call

David

On 3 srp, 12:18, mdipierro mdipie...@cs.depaul.edu wrote:
 If it is done by the LOAD() then there should be a

 request.env.http_web2py_component_location != None

 Massimo

 On Aug 3, 5:00 am, David Marko dma...@tiscali.cz wrote:



  How to detect in controller that request is via AJAX?

  David


Re: [web2py] Re: Getting Eclipse / Pydev running

2010-08-03 Thread Miguel Lopes
On Tue, Aug 3, 2010 at 2:41 AM, pabloest pab...@gmail.com wrote:

 Thank you for the extended description.
 This is almost exactly what I had been following.


You welcome. Interesting to know you came up with a similar solution.


 I had skipped the
 arguments partially because I think Eclipse is not taking them. When I
 enter the arguments and then go to the interpreter tab to see
 resulting command line for the given parameters (button), they do not
 appear. Other commands do appear, but not what I've entered into the
 arguments tab.  Do yours appear there?


Arguments do not appear in the interpreter tab, but they are applied. I you
enter something like   -p 8080 -a recycle   in the arguments tab when
you run web2py.py the startup dialog box should not appear. Give it a try. I
find it very convenient not to have the pesky dialog.



 Aptana gave the same behavior as Eclipse, but I'm not surprised.

 I might try re-downloading web2py's source - perhaps something got
 corrupted.


I wouldn't expect this to be related to web2py.


 Pablo



[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread mdipierro
I do not think you can.

On Aug 3, 5:43 am, David Marko dma...@tiscali.cz wrote:
 I dont use LOAD, I simply call controller function from browser using
 jQUERY $(#ID).load(URL to controller function) and in controller i
 have to detect this ajax call

 David

 On 3 srp, 12:18, mdipierro mdipie...@cs.depaul.edu wrote:

  If it is done by the LOAD() then there should be a

  request.env.http_web2py_component_location != None

  Massimo

  On Aug 3, 5:00 am, David Marko dma...@tiscali.cz wrote:

   How to detect in controller that request is via AJAX?

   David


Re: [web2py] Re: code organization

2010-08-03 Thread Miguel Lopes
Iceberg,

Thank you.
Maybe I didn't explain what I wanted well, but you understood very well!
Actually the solution is so simple it is embarrassing :-)

Miguel


On Tue, Aug 3, 2010 at 9:51 AM, Iceberg iceb...@21cn.com wrote:

 Don't what you really want. In short, modules organize your functional
 code, but you still need to expose them in your controller.

 # In controllers/default.py
 def index():
return {'': DIV( LOAD(url=URL(r=request, f='foo.load')) )}
 def foo():
return {'': local_import('my_module').my_func()}

 # In modules/my_module.py
 def my_func():
return FORM(...)

 Iceberg

 On Aug 2, 10:19 pm, Miguel Lopes mig.e.lo...@gmail.com wrote:
  yes I've tried it. local_import does not work. the LOAD function
 signature
  expects a controller name and function name (defaulting to the
  request.application), as far as I know it is not possible to pass it a
  function - at least supplying it a function object does not work.
 
  Miguel
 
 
 
  On Mon, Aug 2, 2010 at 2:51 PM, Bruno Rocha rochacbr...@gmail.com
 wrote:
   Have you tried local_import()?
   I really dont know if that will work in your case, Give it a try
 
  http://web2py.com/book/default/chapter/04?search=local_import
 
   2010/8/2 Miguel Lopes mig.e.lo...@gmail.com
 
   I have several functions returning forms in a module file, and started
   experimenting with the LOAD function, but I can figure out how to use
 this
   functions without moving them to the controller. I would prefer to
 keep
   these functions in a module for code organization reasons. I wonder if
 it is
   possible, and if not what solution do you use for code organization?
 
   Miguel
 
   --
 
  http://rochacbruno.com.br



[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread Timmie
Hello,
where can we see these changes?

Do you intend to upload?

Thanks.


[web2py] Re: markmin, t2, t3, cube9 etc. (important update)

2010-08-03 Thread Timmie
 This has been in trunk for some time:

  from gluon.html import markmin_serializer
  html='divh1Header/h1pa 
  href=http://google.com;link/abbold/b/div'
  TAG(html).flatten(markmin_serializer)

 '#Header\n\n[[linkhttp://google.com]]**bold**\n\n'

 You can use it to convert markdown syntax:

  from gluon.contrib.markdown import WIKI
  md = '#Header\n\n[link](http://google.com)*bold*\n\n'
  TAG(WIKI(md).xml()).flatten(markmin_serializer)

 #Header\n\n [[linkhttp://google.com]]''bold''\n\n 
What about adding a converter option to pligin_wiki:
User pastes markdown but internally markmin is saved.

Regards.


[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread szabba
On 3 Sie, 12:43, David Marko dma...@tiscali.cz wrote:
 I dont use LOAD, I simply call controller function from browser using
 jQUERY $(#ID).load(URL to controller function) and in controller i
 have to detect this ajax call

You could use a query or path argument - just replace /a/c/f with
/a/c/f?ajax=true or /a/c/f/ajax.

szabba


[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread David Marko
This simple function can make a detection:

def isAjax():
if request.env.http_x_requested_with==None:
return False

if
request.env.http_x_requested_with.lower()=='XMLHttpRequest'.lower():
return True
else:
return False

This could be a part of web2py core.

David

On 3 srp, 13:13, szabba isza...@gmail.com wrote:
 On 3 Sie, 12:43, David Marko dma...@tiscali.cz wrote:

  I dont use LOAD, I simply call controller function from browser using
  jQUERY $(#ID).load(URL to controller function) and in controller i
  have to detect this ajax call

 You could use a query or path argument - just replace /a/c/f with
 /a/c/f?ajax=true or /a/c/f/ajax.

 szabba


[web2py] Re: uft 8

2010-08-03 Thread max
yes. it shows incorrectly in the browser.

On Aug 2, 7:13 pm, Jason Brower encomp...@gmail.com wrote:
 by false do you mean incorrectly in the webbrowser?
 The area that is printing this is python not the html though you should
 have it there. :)
 I am not sure where it is set python side, but I do know my finnish
 äÄöÖåÅ all work for me.
 Best Regards,
 Jason

 On Mon, 2010-08-02 at 02:09 -0700, max wrote:
  dera develpoers,

  i am adding  just a german ä in the menu list. like this.
  T('täter') for translation
  and the web2py shows it false in the browser, althoguth i have setup
  utf-8.

     meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
   in layout.html

  does anybody have similar experiences?


[web2py] Re: uft 8

2010-08-03 Thread max
yes. it shows incorrectly in the browser.

On Aug 2, 7:13 pm, Jason Brower encomp...@gmail.com wrote:
 by false do you mean incorrectly in the webbrowser?
 The area that is printing this is python not the html though you should
 have it there. :)
 I am not sure where it is set python side, but I do know my finnish
 äÄöÖåÅ all work for me.
 Best Regards,
 Jason

 On Mon, 2010-08-02 at 02:09 -0700, max wrote:
  dera develpoers,

  i am adding  just a german ä in the menu list. like this.
  T('täter') for translation
  and the web2py shows it false in the browser, althoguth i have setup
  utf-8.

     meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
   in layout.html

  does anybody have similar experiences?


[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread mdipierro
I just did


On Aug 3, 6:06 am, Timmie timmichel...@gmx-topmail.de wrote:
 Hello,
 where can we see these changes?

 Do you intend to upload?

 Thanks.


[web2py] Re: markmin, t2, t3, cube9 etc. (important update)

2010-08-03 Thread mdipierro
why?

On Aug 3, 6:07 am, Timmie timmichel...@gmx-topmail.de wrote:
  This has been in trunk for some time:

   from gluon.html import markmin_serializer
   html='divh1Header/h1pa 
   href=http://google.com;link/abbold/b/div'
   TAG(html).flatten(markmin_serializer)

  '#Header\n\n[[linkhttp://google.com]]**bold**\n\n'

  You can use it to convert markdown syntax:

   from gluon.contrib.markdown import WIKI
   md = '#Header\n\n[link](http://google.com)*bold*\n\n'
   TAG(WIKI(md).xml()).flatten(markmin_serializer)

  #Header\n\n [[linkhttp://google.com]]''bold''\n\n 

 What about adding a converter option to pligin_wiki:
 User pastes markdown but internally markmin is saved.

 Regards.


[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread mdipierro
interesting.

On Aug 3, 6:20 am, David Marko dma...@tiscali.cz wrote:
 This simple function can make a detection:

 def isAjax():
     if request.env.http_x_requested_with==None:
         return False

     if
 request.env.http_x_requested_with.lower()=='XMLHttpRequest'.lower():
         return True
     else:
         return False

 This could be a part of web2py core.

 David

 On 3 srp, 13:13, szabba isza...@gmail.com wrote:

  On 3 Sie, 12:43, David Marko dma...@tiscali.cz wrote:

   I dont use LOAD, I simply call controller function from browser using
   jQUERY $(#ID).load(URL to controller function) and in controller i
   have to detect this ajax call

  You could use a query or path argument - just replace /a/c/f with
  /a/c/f?ajax=true or /a/c/f/ajax.

  szabba


[web2py] open id, rpx auth: local rpxaccount.py modif

2010-08-03 Thread molhokwai
Hello,

Just to share this modification in the
gluon/contrib/login_methods/rpxaccount.py file that fixes an issue due to
the fact that providers eventually send nothing for specific keys (ex:
Facebook does not send the email key by default).
The code (starting @line 56):

-
self.mappings.Facebook = lambda profile:\
dict(registration_id = profile.get(identifier,),
 username = profile.get(preferredUsername,),
 email = profile.get(email,),
 first_name = profile.get(name,).get(givenName,),
 last_name = profile.get(name,).get(familyName,))
self.mappings.Google = lambda profile:\
dict(registration_id=profile.get(identifier,),
 username=profile.get(preferredUsername,),
 email=profile.get(email,),
 first_name=profile.get(name,).get(givenName,),
 last_name=profile.get(name,).get(familyName,))
self.mappings.default = lambda profile:\
dict(registration_id=profile.get(identifier,),
 username=profile.get(preferredUsername,),
 email=profile.get(email,),
 first_name=profile.get(preferredUsername,),
 last_name='')
-

Voilà.


[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread Niphlod
+1 for this method, is pretty standard in other frameworks too.
Also, according to http://www.w3.org/TR/XMLHttpRequest/#send , the
Accept header must be set as '*/*'.

(and I think that there is one too much lower()), :

...
if request.env.http_x_requested_with.lower()=='xmlhttprequest':
...


[web2py] cool pyjamas web2py app on GAE :)

2010-08-03 Thread Oleg
http://pymines.appspot.com/


[web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread aure
+1

On Aug 2, 12:16 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 Web2py is Great, Greatest framework that i had ever tried and stick onto it.

 But what it is lacking is publicity and lack of KILLER web-apps like those
 Made PHP most popular web-development platform.
 Here are some , what that had made PHP Popular and which will also make
 Web2py + Python all together more popular and makes development enviorment
 of Choice for web:

 Necessary APPS:

 *Database Administration:*

 phpMyAdmin - Is the Most used webbased Database Manager ever

 we have admin for web2py but that alone is not sufficient, we need a DB
 Admin for every Databases on the current system .
 Current commercial project i am doing have some features for it and when i
 free i will start making dedicated one . I will need contributers later.

 Hows about PySQLAdmin sounds?

 *File Manager :*

 Those who work on LAMP , they usually use a file manager like net2ftp.
 Current my  elFinder-web2py works well for this case, but i need
 contributors .

 *CMS*

 KPAX exist but it is not dedicatedly maintained , we will need dedicated
 maintainers for it , lets let Massimo dedicate his works on web2py.
 KPAX should  not only be as Appliance , it should have its own Domain and
 brand.And lets make it better than CMS.

 *Blog*

 There are many blog exist on the appliance , but we need a dedicate best one
 that can go toes to toes against Wordpress.
 + will need A Dedicated domain , and maintainer.
 *
 *
 *
 *
 KILLER APP Ideas

 *Stack Overflow Clone:*

 For web2py community and as separate Open Source Project , lets make a SO
 Clone?

 *Email Client:*
 *
 *
 Python have a very rich Built-in mail handling libs , developing a
 gmail-clone wont be hard at all.

 Ticketing Systems:

 Many enterprises needs a Help Desk/ Ticketing system . Best one i used is RT
 (Perl based ticketing system). We can make a better one based on web2py.

 What i can contribute :

 I am planning to provide a site for hosting web2py app and demos for it. I
 have server / space and good domain (www.web2pyhost.com, scaryhits.com)  or
 should it be web2pyapps.com
 for code hosting we can use google for that.

 *
 *


[web2py] Can LOAD trap links too?

2010-08-03 Thread mr.freeze
If I click a link in a component that has ajax=True,  it takes me to a
bare page with only the component. Can we add the option to trap links
too?


[web2py] Re: ARTICLE: The good and bad about web2py

2010-08-03 Thread Iceberg
On Aug 2, 4:56 am, Jason Brower encomp...@gmail.com wrote:
 Annoying as i can't view the errors without copying them locally first off 
 the web server and reading them from my personal computer.


You can, just configure properly the web2py admin interface on your
production site.

Even you did not setup or don't want the admin on production server,
it is still a good thing that the errors can be copied to development
server and view and debug. Isn't i?


 Hence why i felt we need a console based reader for web2py error files.
Why a separated error viewer is needed? Don't you need an entire
development environment, as soon as after viewing the error and start
debug?

Regards,
iceberg


Re: [web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread Jonathan Lundell
On Aug 3, 2010, at 5:33 AM, Niphlod wrote:

 +1 for this method, is pretty standard in other frameworks too.
 Also, according to http://www.w3.org/TR/XMLHttpRequest/#send , the
 Accept header must be set as '*/*'.
 
 (and I think that there is one too much lower()), :
 
 ...
 if request.env.http_x_requested_with.lower()=='xmlhttprequest':
 ...

Also too many ifs.

return request.env.http_x_requested_with and 
request.env.http_x_requested_with.lower() == 'xmlhttprequest'

or something like that... 

[web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread JorgeRpo

+1


Re: [web2py] Re: plugin_wiki suggestions

2010-08-03 Thread Bruno Rocha
Thanks, Massimo

I have no doubt, I will keep the markmin as markup language for my site, I
did a comparison and I write much faster with markmin than with LaTeX,
markdown, html Or Another.

I'll do everything possible to contribute on issues that I have knowledge. if
I get some success will send a patch.

I suggested using the page title as title by questions of SEO,
concatenating site name + pageTitle:
title My Wiki Site | My Page Title / title  Considering that plugin_wiki
can be used as a CMS platform (as in my case).

{{=thanks*10}}

2010/8/3 mdipierro mdipie...@cs.depaul.edu

 I never though somebody sould have more than 1000 revisions. Let's
 think about a good solution. The one you propose may be ok.

 On Aug 2, 3:54 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  - Page History
  page history does not works on GAE,
 http://web2pybrasil.appspot.com/init/plugin_wiki/page_history/home Fails
  and raises a ticket
 
  There is a limit to history entries per page?
 
  I mean, if I edit a page too many times this will create too many entries
 in
  plugin_wiki_page_history
  I think it needs a limit, may be 20 entries per page like a FIFO
 
  2010/8/1 Bruno Rocha rochacbr...@gmail.com
 
 
 
   I am developing and writing a lot with plugin_wiki (cube2py). I already
   have some suggestions, observations and have also found some bugs.
   As I'm finding more issues, I will posting here in this thread. If
 someone
   else has something to add, enjoy the thread.
 
   I am working now on this page :
  http://web2pybrasil.appspot.com/cursoweb2py/
 
   *
   *
   *Bugs I Found:*
 
   -* **Comments Widget*
   I noticed that the comments widget is restricted to logged in users,
 the
   code that generates the widget has requires_login (), this is great for
   protecting users not logged in to write.
   however, as the same widget generates the form for adding a comment,
 and
   also generates a list of comments to display, it is not possible to
 display
   existing comments to a user who is not logged.
   I suggest dividing into two widgets, one to generate the form of
 insertion,
   and this would be protected. And another to generate a list of existing
   comments, and this would free reading. this last could be used in
 another
   place eg:  to show recent comments for a page.
 
   -* Searches with crud.search and jqgrid on GAE*
   I got error using crud.search and jqgrid widgets, as GAE does not allow
 to
   perform LIKE, StartsWIth, EndsWith, Contains, etc, while do not have
 any
   workarround, I think that options should be disabled When it is
 detected
   that is working in GAE
 
   *Suggestions:*( Too many things. Sorry )
 
   - *Widget_Builder:*
   Binds the code generated by widget builder direct to the page content
   editor, I think it is not hard to do with JavaScript, preventing the
   copy-paste when using widget builder
 
   - *Widget* *Messages customization*
   Include the total capacity for customize the output messages  in the
   standard widgets. load_action and load_url eg uses AJAX and display
   the message loading, it would be nice to have how to pass as a
 parameter,
   a new message to be displayed, it is usefull for translating.
 
   - *Blank lines, white space:*
   Markdown for example set spaces by using two blank spaces at the end of
   each line to make a break, I'm developing a lot with plugin_wiki and
 had to
   create a function just to give me white space and blank lines.
   ``{{=br(2)}}``:template
 
   - *Categories:*
   wiki or any other type of page created with plugin_wiki, IMHO, will
 need
   some kind of category management. it is not difficult to implement as
   standard, without having to create custom widgets, as I had to do.
 
   - *Search: *
   I created a custom widget that performs searches in titles, slugs, and
 body
   of the pages, and it is running on GAE,  I believe this should be used
 as a
   widget placed on the meta-header, or meta-sidebar for example. but
 could
   be part of the plugin itself, considering that this is a basic need of
 any
   wiki page.
 
   - *Link Targets:*
   I do not think there is a specific reason not to open external links in
 a
   wiki page, wikipedia does, it would be interesting to receive the
 parameter
   target by default in the marking of a [[link]] as [[linktitle
  http://linkurl blank]]
 
   - *Preview and Saving: *
   It is very annoying having to submit  the page every time we need to
 save,
   then to have a preview, the saving could happen with AJAX and have
 option to
   view a Preview window.
 
   - *Lists:*
In ordered and unordered lists creates with - and +, Needs a way to
 create
   sublevels with lists, maybe -- and ++
   - A Topic
   -- Subtopic of A Topic
   --- Subtopic of a subtopic of A Topic
   -- Another subtopic of A Topic
 
   + A Topic
   ++ Subtopic of A Topic
   +++ Subtopic of a subtopic of A Topic
   ++ Another subtopic of A Topic
 
   - *Page auto reference:*
   It would be interesting to have a 

[web2py] Re: open id, rpx auth: local rpxaccount.py modif

2010-08-03 Thread mdipierro
thanks, uploading fix

On Aug 3, 7:09 am, molhokwai molhok...@gmail.com wrote:
 Hello,

 Just to share this modification in the
 gluon/contrib/login_methods/rpxaccount.py file that fixes an issue due to
 the fact that providers eventually send nothing for specific keys (ex:
 Facebook does not send the email key by default).
 The code (starting @line 56):

 -
         self.mappings.Facebook = lambda profile:\
             dict(registration_id = profile.get(identifier,),
                  username = profile.get(preferredUsername,),
                  email = profile.get(email,),
                  first_name = profile.get(name,).get(givenName,),
                  last_name = profile.get(name,).get(familyName,))
         self.mappings.Google = lambda profile:\
             dict(registration_id=profile.get(identifier,),
                  username=profile.get(preferredUsername,),
                  email=profile.get(email,),
                  first_name=profile.get(name,).get(givenName,),
                  last_name=profile.get(name,).get(familyName,))
         self.mappings.default = lambda profile:\
             dict(registration_id=profile.get(identifier,),
                  username=profile.get(preferredUsername,),
                  email=profile.get(email,),
                  first_name=profile.get(preferredUsername,),
                  last_name='')
 -

 Voilà.


[web2py] Re: cool pyjamas web2py app on GAE :)

2010-08-03 Thread mdipierro
http://www.reddit.com/r/programming/comments/cwve1/minesweeper/

On Aug 3, 8:07 am, Oleg obutov...@googlemail.com wrote:
 http://pymines.appspot.com/


[web2py] Re: Can LOAD trap links too?

2010-08-03 Thread mdipierro
You can modify web2py_ajax.html and replace

function web2py_trap_form(action,target)
{
   jQuery('#'+target+' form').each(function(i)
{
  var
form=jQuery(this);
  if(!
form.hasClass('no_trap'))
form.submit(function(obj)
{
 
jQuery('.flash').hide().html('');
 
web2py_ajax_page('post',action,form.serialize(),target);
 return
false;
  });
   });
}


with

function web2py_trap_form(action,target)
{
   jQuery('#'+target+' form').each(function(i)
{
  var
form=jQuery(this);
  if(!
form.hasClass('no_trap'))
form.submit(function(obj)
{
 
jQuery('.flash').hide().html('');
 
web2py_ajax_page('post',action,form.serialize(),target);
 return
false;
  });
   });
   /* add this
*/
   jQuery('#'+target+' a').each(function(i)
{
  var
a=jQuery(this);
  if(!
a.hasClass('no_trap'))
a.click(function(obj)
{
 
jQuery('.flash').hide().html('');
 web2py_ajax_page('get',a.attr('href'),
[],target);
 return
false;
  });
   });
}


On Aug 3, 9:34 am, mr.freeze nat...@freezable.com wrote:
 If I click a link in a component that has ajax=True,  it takes me to a
 bare page with only the component. Can we add the option to trap links
 too?


[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread mdipierro
OK, in trunk

request.ajax can be true or false

On Aug 3, 6:20 am, David Marko dma...@tiscali.cz wrote:
 This simple function can make a detection:

 def isAjax():
     if request.env.http_x_requested_with==None:
         return False

     if
 request.env.http_x_requested_with.lower()=='XMLHttpRequest'.lower():
         return True
     else:
         return False

 This could be a part of web2py core.

 David

 On 3 srp, 13:13, szabba isza...@gmail.com wrote:

  On 3 Sie, 12:43, David Marko dma...@tiscali.cz wrote:

   I dont use LOAD, I simply call controller function from browser using
   jQUERY $(#ID).load(URL to controller function) and in controller i
   have to detect this ajax call

  You could use a query or path argument - just replace /a/c/f with
  /a/c/f?ajax=true or /a/c/f/ajax.

  szabba


[web2py] Re: plugin_wiki suggestions

2010-08-03 Thread mdipierro
And I did send you the markmin2latex.py the book chap13 I posted is
pure markmin2latex output without any manual edit.

On Aug 3, 7:46 am, Bruno Rocha rochacbr...@gmail.com wrote:
 Thanks, Massimo

 I have no doubt, I will keep the markmin as markup language for my site, I
 did a comparison and I write much faster with markmin than with LaTeX,
 markdown, html Or Another.

 I'll do everything possible to contribute on issues that I have knowledge. if
 I get some success will send a patch.

 I suggested using the page title as title by questions of SEO,
 concatenating site name + pageTitle:
 title My Wiki Site | My Page Title / title  Considering that plugin_wiki
 can be used as a CMS platform (as in my case).

 {{=thanks*10}}

 2010/8/3 mdipierro mdipie...@cs.depaul.edu



  I never though somebody sould have more than 1000 revisions. Let's
  think about a good solution. The one you propose may be ok.

  On Aug 2, 3:54 pm, Bruno Rocha rochacbr...@gmail.com wrote:
   - Page History
   page history does not works on GAE,
 http://web2pybrasil.appspot.com/init/plugin_wiki/page_history/homeFails
   and raises a ticket

   There is a limit to history entries per page?

   I mean, if I edit a page too many times this will create too many entries
  in
   plugin_wiki_page_history
   I think it needs a limit, may be 20 entries per page like a FIFO

   2010/8/1 Bruno Rocha rochacbr...@gmail.com

I am developing and writing a lot with plugin_wiki (cube2py). I already
have some suggestions, observations and have also found some bugs.
As I'm finding more issues, I will posting here in this thread. If
  someone
else has something to add, enjoy the thread.

I am working now on this page :
   http://web2pybrasil.appspot.com/cursoweb2py/

*
*
*Bugs I Found:*

-* **Comments Widget*
I noticed that the comments widget is restricted to logged in users,
  the
code that generates the widget has requires_login (), this is great for
protecting users not logged in to write.
however, as the same widget generates the form for adding a comment,
  and
also generates a list of comments to display, it is not possible to
  display
existing comments to a user who is not logged.
I suggest dividing into two widgets, one to generate the form of
  insertion,
and this would be protected. And another to generate a list of existing
comments, and this would free reading. this last could be used in
  another
place eg:  to show recent comments for a page.

-* Searches with crud.search and jqgrid on GAE*
I got error using crud.search and jqgrid widgets, as GAE does not allow
  to
perform LIKE, StartsWIth, EndsWith, Contains, etc, while do not have
  any
workarround, I think that options should be disabled When it is
  detected
that is working in GAE

*Suggestions:*( Too many things. Sorry )

- *Widget_Builder:*
Binds the code generated by widget builder direct to the page content
editor, I think it is not hard to do with JavaScript, preventing the
copy-paste when using widget builder

- *Widget* *Messages customization*
Include the total capacity for customize the output messages  in the
standard widgets. load_action and load_url eg uses AJAX and display
the message loading, it would be nice to have how to pass as a
  parameter,
a new message to be displayed, it is usefull for translating.

- *Blank lines, white space:*
Markdown for example set spaces by using two blank spaces at the end of
each line to make a break, I'm developing a lot with plugin_wiki and
  had to
create a function just to give me white space and blank lines.
``{{=br(2)}}``:template

- *Categories:*
wiki or any other type of page created with plugin_wiki, IMHO, will
  need
some kind of category management. it is not difficult to implement as
standard, without having to create custom widgets, as I had to do.

- *Search: *
I created a custom widget that performs searches in titles, slugs, and
  body
of the pages, and it is running on GAE,  I believe this should be used
  as a
widget placed on the meta-header, or meta-sidebar for example. but
  could
be part of the plugin itself, considering that this is a basic need of
  any
wiki page.

- *Link Targets:*
I do not think there is a specific reason not to open external links in
  a
wiki page, wikipedia does, it would be interesting to receive the
  parameter
target by default in the marking of a [[link]] as [[linktitle
   http://linkurlblank]]

- *Preview and Saving: *
It is very annoying having to submit  the page every time we need to
  save,
then to have a preview, the saving could happen with AJAX and have
  option to
view a Preview window.

- *Lists:*
 In ordered and unordered lists creates with - and +, Needs a way to
  create
sublevels with lists, maybe -- and ++
- A Topic
-- Subtopic 

[web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread mdipierro
This code is equivalent to yours, also runs on GAE, and it is faster:

@staticmethod
def searchPages(string=None,nfmessage='Nothing found with %s'):
pages = db(db.plugin_wiki_page.id0).select().find(lambda row:
\
  string and (string in row.slug or string in
row.body or string in row.title) and not row.slug.startswith('meta'))
if pages:
return
UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',args=page.slug)))
for page in pages])
else:
return ''


On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Thats the way I found to perform LIKE() search in GAE, it is ugly (I know)
 but works.. I am waiting for any feature to replace this.

 @staticmethod
     def searchPages(string=None,nfmessage='Nothing found with %s'):
         
         string: string to be found
         
         found = set()
         string = request.vars.search
         if string:
             #search in slug
             pages =
 db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
             for page in pages:
                 if page.slug.find(string)  -1:
                     found.add(page.slug)

             #search in page body
             pages =
 db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
             for page in pages:
                 if page.body.find(string)  -1:
                     found.add(page.slug)

             #search in page title
             pages =
 db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
             for page in pages:
                 if page.title.find(string)  -1:
                     found.add(page.slug)

             if found:
                 cleanfound = set()
                 for row in found:
                     if row[:4]!='meta':
                         cleanfound.add(row)

                 return UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\

 .select(db.plugin_wiki_page.title)[0].title),\

 _href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
                                 for row in cleanfound])
             #r=request,f='page'
             else:
                 return nfmessage % string

         else:
             return ''

 2010/8/2 Martin.Mulone mulone.mar...@gmail.com



  I use like() to search, but in a near future this could be disabled.

  On Aug 2, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
   Running locally InstantPress looks awesome, quickly, beauty/clean layout
  and
   I loved the way you treat Admin Buttons.

   Congratulations!

   But, this could not works on GAE, I saw a lot of code that is not allowed
  on
   GAE, you are using .like() in get_lats_pots_with_search()

   Today I will try to run it on GAE, testing  some workarround, then I
  report
   you.

   {{=thanks}}

   2010/8/2 Martin.Mulone mulone.mar...@gmail.com

I don know I think yes, but I dont test it.

On Aug 2, 9:45 am, Bruno Rocha rochacbr...@gmail.com wrote:
 Martin, is it able to work on GAE ?

 2010/8/2 Martin.Mulone mulone.mar...@gmail.com

  I am working in a cms *blog style* the idea is to be simple, ready
  to
  work, looking professional, and use ajax and effect in admin panel
  at
  least. You can see here:
 http://code.google.com/p/instant-press/Itis
  in developing state but many things are working. I am working on it
  in
  the last 2 or 3 weeks. All the ideas, bugs and others comments are
  welcome. Here where I work Iam prommoting web2py.

  Can admin users.
  Can admin articles.
  Can admin comments.
  Can admin categories.
  Can admin information of the site.

  On Aug 2, 7:16 am, Phyo Arkar phyo.arkarl...@gmail.com wrote:
   Web2py is Great, Greatest framework that i had ever tried and
  stick
onto
  it.

   But what it is lacking is publicity and lack of KILLER web-apps
  like
  those
   Made PHP most popular web-development platform.
   Here are some , what that had made PHP Popular and which will
  also
make
   Web2py + Python all together more popular and makes development
  enviorment
   of Choice for web:

   Necessary APPS:

   *Database Administration:*

   phpMyAdmin - Is the Most used webbased Database Manager ever

   we have admin for web2py but that alone is not sufficient, we
  need a
DB
   Admin for every Databases on the current system .
   Current commercial project i am doing have some features for it
  and
when
  i
   free i will start making dedicated one . I will need contributers
later.

   Hows about PySQLAdmin sounds?

   *File Manager :*

   Those who work on LAMP , they usually use a file manager like
net2ftp.
   Current my  elFinder-web2py works well for this case, but i need
   contributors .

   *CMS*

   KPAX exist but it is not dedicatedly maintained , we 

Re: [web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread Phyo Arkar
Ok Back to Topic
Instant Press , looks good

With some work , that one could become a standard Blog for Web2py .

mulone martin , you should be branding it .
Get a domain for it as a dedicate site , and to some of us who want to
contribute , assign task at google code.

Prof Massimo , your reddit clone can also become a killer APP , shouln't you
make a site dedicated for it and host it at googlecode + assign task to us ,
so we can contribute?

googlecode have huge SEO advantage for opensource projects.


On Tue, Aug 3, 2010 at 10:17 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 This code is equivalent to yours, also runs on GAE, and it is faster:

 @staticmethod
def searchPages(string=None,nfmessage='Nothing found with %s'):
 pages = db(db.plugin_wiki_page.id0).select().find(lambda row:
 \
  string and (string in row.slug or string in
 row.body or string in row.title) and not row.slug.startswith('meta'))
if pages:
return

 UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',args=page.slug)))
 for page in pages])
else:
return ''


 On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  Thats the way I found to perform LIKE() search in GAE, it is ugly (I
 know)
  but works.. I am waiting for any feature to replace this.
 
  @staticmethod
  def searchPages(string=None,nfmessage='Nothing found with %s'):
  
  string: string to be found
  
  found = set()
  string = request.vars.search
  if string:
  #search in slug
  pages =
  db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
  for page in pages:
  if page.slug.find(string)  -1:
  found.add(page.slug)
 
  #search in page body
  pages =
  db(db.plugin_wiki_page.id
 0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
  for page in pages:
  if page.body.find(string)  -1:
  found.add(page.slug)
 
  #search in page title
  pages =
  db(db.plugin_wiki_page.id
 0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
  for page in pages:
  if page.title.find(string)  -1:
  found.add(page.slug)
 
  if found:
  cleanfound = set()
  for row in found:
  if row[:4]!='meta':
  cleanfound.add(row)
 
  return UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\
 
  .select(db.plugin_wiki_page.title)[0].title),\
 
  _href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
  for row in cleanfound])
  #r=request,f='page'
  else:
  return nfmessage % string
 
  else:
  return ''
 
  2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 
 
   I use like() to search, but in a near future this could be disabled.
 
   On Aug 2, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
Running locally InstantPress looks awesome, quickly, beauty/clean
 layout
   and
I loved the way you treat Admin Buttons.
 
Congratulations!
 
But, this could not works on GAE, I saw a lot of code that is not
 allowed
   on
GAE, you are using .like() in get_lats_pots_with_search()
 
Today I will try to run it on GAE, testing  some workarround, then I
   report
you.
 
{{=thanks}}
 
2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 I don know I think yes, but I dont test it.
 
 On Aug 2, 9:45 am, Bruno Rocha rochacbr...@gmail.com wrote:
  Martin, is it able to work on GAE ?
 
  2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
   I am working in a cms *blog style* the idea is to be simple,
 ready
   to
   work, looking professional, and use ajax and effect in admin
 panel
   at
   least. You can see here:
  http://code.google.com/p/instant-press/Itis
   in developing state but many things are working. I am working
 on it
   in
   the last 2 or 3 weeks. All the ideas, bugs and others comments
 are
   welcome. Here where I work Iam prommoting web2py.
 
   Can admin users.
   Can admin articles.
   Can admin comments.
   Can admin categories.
   Can admin information of the site.
 
   On Aug 2, 7:16 am, Phyo Arkar phyo.arkarl...@gmail.com
 wrote:
Web2py is Great, Greatest framework that i had ever tried and
   stick
 onto
   it.
 
But what it is lacking is publicity and lack of KILLER
 web-apps
   like
   those
Made PHP most popular web-development platform.
Here are some , what that had made PHP Popular and which will
   also
 make
Web2py + Python all together more popular and makes
 development
   enviorment
of Choice for web:
 
Necessary APPS:
 

[web2py] GAETest or NoseGAE

2010-08-03 Thread PanosJee
Hi guys,
I want to run some tests for my app (runs on gae) but i cannot find
much.
I am investigating the use of http://code.google.com/p/gaeunit/
Reading the wiki it seems it is suited to WebApp but we could modify
it a bit to work with web2py.
What do you think?


Re: [web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread Phyo Arkar
Another necessary app:

Currently , there are so few python hosting providers especially for  shared
hosting.
We need a Hosting Control panel for web2py.

Even Web2py admin modifcation with different admins for each projects should
work. But there may be security concern as web2py allows full python access.
There is Python Virtual env for it right?

Anyone wanna give it a shot?

On Tue, Aug 3, 2010 at 10:41 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:

 Ok Back to Topic
 Instant Press , looks good

 With some work , that one could become a standard Blog for Web2py .

 mulone martin , you should be branding it .
 Get a domain for it as a dedicate site , and to some of us who want to
 contribute , assign task at google code.

 Prof Massimo , your reddit clone can also become a killer APP , shouln't
 you make a site dedicated for it and host it at googlecode + assign task to
 us , so we can contribute?

 googlecode have huge SEO advantage for opensource projects.



 On Tue, Aug 3, 2010 at 10:17 PM, mdipierro mdipie...@cs.depaul.eduwrote:

 This code is equivalent to yours, also runs on GAE, and it is faster:

 @staticmethod
def searchPages(string=None,nfmessage='Nothing found with %s'):
 pages = db(db.plugin_wiki_page.id0).select().find(lambda row:
 \
  string and (string in row.slug or string in
 row.body or string in row.title) and not row.slug.startswith('meta'))
if pages:
return

 UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',args=page.slug)))
 for page in pages])
else:
return ''


 On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  Thats the way I found to perform LIKE() search in GAE, it is ugly (I
 know)
  but works.. I am waiting for any feature to replace this.
 
  @staticmethod
  def searchPages(string=None,nfmessage='Nothing found with %s'):
  
  string: string to be found
  
  found = set()
  string = request.vars.search
  if string:
  #search in slug
  pages =
  db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
  for page in pages:
  if page.slug.find(string)  -1:
  found.add(page.slug)
 
  #search in page body
  pages =
  db(db.plugin_wiki_page.id
 0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
  for page in pages:
  if page.body.find(string)  -1:
  found.add(page.slug)
 
  #search in page title
  pages =
  db(db.plugin_wiki_page.id
 0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
  for page in pages:
  if page.title.find(string)  -1:
  found.add(page.slug)
 
  if found:
  cleanfound = set()
  for row in found:
  if row[:4]!='meta':
  cleanfound.add(row)
 
  return
 UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\
 
  .select(db.plugin_wiki_page.title)[0].title),\
 
  _href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
  for row in cleanfound])
  #r=request,f='page'
  else:
  return nfmessage % string
 
  else:
  return ''
 
  2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 
 
   I use like() to search, but in a near future this could be disabled.
 
   On Aug 2, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
Running locally InstantPress looks awesome, quickly, beauty/clean
 layout
   and
I loved the way you treat Admin Buttons.
 
Congratulations!
 
But, this could not works on GAE, I saw a lot of code that is not
 allowed
   on
GAE, you are using .like() in get_lats_pots_with_search()
 
Today I will try to run it on GAE, testing  some workarround, then I
   report
you.
 
{{=thanks}}
 
2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 I don know I think yes, but I dont test it.
 
 On Aug 2, 9:45 am, Bruno Rocha rochacbr...@gmail.com wrote:
  Martin, is it able to work on GAE ?
 
  2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
   I am working in a cms *blog style* the idea is to be simple,
 ready
   to
   work, looking professional, and use ajax and effect in admin
 panel
   at
   least. You can see here:
  http://code.google.com/p/instant-press/Itis
   in developing state but many things are working. I am working
 on it
   in
   the last 2 or 3 weeks. All the ideas, bugs and others comments
 are
   welcome. Here where I work Iam prommoting web2py.
 
   Can admin users.
   Can admin articles.
   Can admin comments.
   Can admin categories.
   Can admin information of the site.
 
   On Aug 2, 7:16 am, Phyo Arkar phyo.arkarl...@gmail.com
 wrote:
Web2py is Great, 

[web2py] Re: How does cache.ram work on wsgi mode?

2010-08-03 Thread Iceberg
On Aug 3, 7:39 pm, iceb...@21cn.com wrote:
 Well, actually I am not sure whether is a wsgi problem or a webfaction 
 problem. Anyway I just observe TWO separated instances of cache.ram inside 
 ONE web2py instance. How could this be?

 Detail description.

 One of my web2py app's action is to refresh cache.ram and then log the result.

         def cron_job():
                 session.forget() # otherwise session files will pile up 
 unnecessarily
                 cache.ram('foo', lambda: time_consuming_job(), 
 time_expire=1800)

                 # following code borrowed from appadmin.py's ccache()
                 ram = { 'hits':0, 'misses':0 }
                 for key, value in cache.ram.storage.items():
                         if isinstance(value, dict):
                                 ram['hits'] = value['hit_total'] - 
 value['misses']
                                 ram['misses'] = value['misses']

                 status = 'hit:%d, miss:%d' % (ram['hits'], ram['misses'])
                 open('cron_job.log', 'a').write('... (%s), [%s]'% (..., 
 request.client, status))

 And there is an external web2py cron running this trigger script:
         import urllib
         urllib.urlopen('http://localhost:54321/myapp/default/cron_job').read()

 I setup web2py on webfaction days before. It is in wsgi mode, and I shrink 
 the working process from 2 to 1 (in order to use cache.ram supposedly). The 
 default apache2/conf/httpd.conf is very short and here is the important part 
 (I think):
         LoadModule rewrite_module modules/mod_rewrite.so
         Listen 54321
         LogFormat %{X-Forwarded-For}i %l %u %t \%r\ %s %b \%{Referer}i\ 
 \%{User-Agent}i\ %D combined
         CustomLog /home/iceberg1975/logs/user/access_web2py_1_81_5.log 
 combined
         ServerLimit 1
         WSGIScriptAlias / 
 /home/my_webfaction_account/webapps/web2py_1_81_5/web2py/wsgihandler.py

 Everything seemingly works fine, until I surprisingly notice that, web2py 
 uses one cache.ram instance when being visited by a real-world request, but 
 uses another separated cache.ram instance when being visited by the 
 localhost's cron job.

 Here is the apache log when being visited by a real-world request:
 112.94.8.140 - - [03/Aug/2010:05:38:40 -0500] GET /myapp/default/cron_job 
 HTTP/1.0 200 15 - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) 
 AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4 34391

 And here is the apache log when being visited by local cron script, note that 
 there is no incoming IP:
 - - - [03/Aug/2010:05:39:05 -0500] GET /myapp/default/cron_job HTTP/1.0 200 
 19 - Python-urllib/1.17 33972

 Both generate similar log on web2py level:
 127.0.0.1, 2010-08-03 05:38:40, GET, /myapp/default/cron_job, HTTP/1.0, 200, 
 0.033933
 127.0.0.1, 2010-08-03 05:39:05, GET, /myapp/default/cron_job, HTTP/1.0, 200, 
 0.033501

 But the cron_job.log reveals the difference, they are hitting different 
 cache.ram instance. How come?
 Triggered at Tue Aug  3 05:38:40 2010, took 0.002 seconds. (112.94.8.140). 
 [hit:54, miss:64]
 Triggered at Tue Aug  3 05:39:05 2010, took 0.002 seconds. (127.0.0.1). 
 [hit:20727, miss:702]

 Oh yes, I guess one of the workaround/solution is to use cache.disk or 
 cache.memcache instead. But I am still curious to know what cause the above 
 two cache.ram instances problem even when I am running only one web2py 
 process. Or, do I?
 [my_wf_acco...@web150 conf]$ ps -ef|grep 1_81
 528       3529     1  0 Aug01 ?        00:00:00 
 /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/bin/httpd -f 
 /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/conf/httpd.conf -k start
 528       3531  3529  0 Aug01 ?        00:01:37 
 /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/bin/httpd -f 
 /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/conf/httpd.conf -k start

 Any feedback will be appreciated.

 Sincerely,
              Iceberg, 2010-Aug-03, 18:39(PM), Tue


Mmm, I (partially) know the cause and solution. It is my cron script.
Change it from:
urllib.urlopen('http://localhost:54321/myapp/default/
cron_job').read()
into:
urllib.urlopen('http://MY_DOMAIN:80/myapp/default/
cron_job').read()
then the cron script DOES visit the server in exactly same way as end
user's browser, then serving by the same cache.ram instance. Problem
disappear.

I still don't know why a localhost:wsgi_port will cause problem. If
anyone has a theory or explanation, I will be more than happy to know.

That is it for today, my day X experience of web2py on webfaction.

Regards,
Iceberg


[web2py] Re: How does cache.ram work on wsgi mode?

2010-08-03 Thread mdipierro
It depends on how apache is configured. If you are serving two
different ports it is possible it is creating two processes. In this
case you have one cache.ram per process.

On Aug 3, 11:19 am, Iceberg iceb...@21cn.com wrote:
 On Aug 3, 7:39 pm, iceb...@21cn.com wrote:



  Well, actually I am not sure whether is a wsgi problem or a webfaction 
  problem. Anyway I just observe TWO separated instances of cache.ram inside 
  ONE web2py instance. How could this be?

  Detail description.

  One of my web2py app's action is to refresh cache.ram and then log the 
  result.

          def cron_job():
                  session.forget() # otherwise session files will pile up 
  unnecessarily
                  cache.ram('foo', lambda: time_consuming_job(), 
  time_expire=1800)

                  # following code borrowed from appadmin.py's ccache()
                  ram = { 'hits':0, 'misses':0 }
                  for key, value in cache.ram.storage.items():
                          if isinstance(value, dict):
                                  ram['hits'] = value['hit_total'] - 
  value['misses']
                                  ram['misses'] = value['misses']

                  status = 'hit:%d, miss:%d' % (ram['hits'], ram['misses'])
                  open('cron_job.log', 'a').write('... (%s), [%s]'% (..., 
  request.client, status))

  And there is an external web2py cron running this trigger script:
          import urllib
          
  urllib.urlopen('http://localhost:54321/myapp/default/cron_job').read()

  I setup web2py on webfaction days before. It is in wsgi mode, and I shrink 
  the working process from 2 to 1 (in order to use cache.ram supposedly). The 
  default apache2/conf/httpd.conf is very short and here is the important 
  part (I think):
          LoadModule rewrite_module modules/mod_rewrite.so
          Listen 54321
          LogFormat %{X-Forwarded-For}i %l %u %t \%r\ %s %b 
  \%{Referer}i\ \%{User-Agent}i\ %D combined
          CustomLog /home/iceberg1975/logs/user/access_web2py_1_81_5.log 
  combined
          ServerLimit 1
          WSGIScriptAlias / 
  /home/my_webfaction_account/webapps/web2py_1_81_5/web2py/wsgihandler.py

  Everything seemingly works fine, until I surprisingly notice that, web2py 
  uses one cache.ram instance when being visited by a real-world request, but 
  uses another separated cache.ram instance when being visited by the 
  localhost's cron job.

  Here is the apache log when being visited by a real-world request:
  112.94.8.140 - - [03/Aug/2010:05:38:40 -0500] GET /myapp/default/cron_job 
  HTTP/1.0 200 15 - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) 
  AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4 34391

  And here is the apache log when being visited by local cron script, note 
  that there is no incoming IP:
  - - - [03/Aug/2010:05:39:05 -0500] GET /myapp/default/cron_job HTTP/1.0 
  200 19 - Python-urllib/1.17 33972

  Both generate similar log on web2py level:
  127.0.0.1, 2010-08-03 05:38:40, GET, /myapp/default/cron_job, HTTP/1.0, 
  200, 0.033933
  127.0.0.1, 2010-08-03 05:39:05, GET, /myapp/default/cron_job, HTTP/1.0, 
  200, 0.033501

  But the cron_job.log reveals the difference, they are hitting different 
  cache.ram instance. How come?
  Triggered at Tue Aug  3 05:38:40 2010, took 0.002 seconds. (112.94.8.140). 
  [hit:54, miss:64]
  Triggered at Tue Aug  3 05:39:05 2010, took 0.002 seconds. (127.0.0.1). 
  [hit:20727, miss:702]

  Oh yes, I guess one of the workaround/solution is to use cache.disk or 
  cache.memcache instead. But I am still curious to know what cause the above 
  two cache.ram instances problem even when I am running only one web2py 
  process. Or, do I?
  [my_wf_acco...@web150 conf]$ ps -ef|grep 1_81
  528       3529     1  0 Aug01 ?        00:00:00 
  /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/bin/httpd -f 
  /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/conf/httpd.conf -k start
  528       3531  3529  0 Aug01 ?        00:01:37 
  /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/bin/httpd -f 
  /home/MY_WF_ACCOUNT/webapps/web2py_1_81_5/apache2/conf/httpd.conf -k start

  Any feedback will be appreciated.

  Sincerely,
               Iceberg, 2010-Aug-03, 18:39(PM), Tue

 Mmm, I (partially) know the cause and solution. It is my cron script.
 Change it from:
     urllib.urlopen('http://localhost:54321/myapp/default/
 cron_job').read()
 into:
     urllib.urlopen('http://MY_DOMAIN:80/myapp/default/
 cron_job').read()
 then the cron script DOES visit the server in exactly same way as end
 user's browser, then serving by the same cache.ram instance. Problem
 disappear.

 I still don't know why a localhost:wsgi_port will cause problem. If
 anyone has a theory or explanation, I will be more than happy to know.

 That is it for today, my day X experience of web2py on webfaction.

 Regards,
 Iceberg


Re: [web2py] Ladies and Gentelmen... the web2py book is online

2010-08-03 Thread Mr admin
I can't login, but here is a change for IS_STRONG

  current  

* min is minimum length of the value
* special is the minimum number of required special characters
* is the minimum number of upper case characters

= suggested changes 

* min is minimum length of the value
* special is the minimum number of required special characters
 special characters are any of the followiing !...@#$%^*(){}[]-+
* upper is the minimum number of upper case characters


On Thu, Feb 11, 2010 at 8:30 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 http://web2py.com/book

 This is only for testing purposes.
 Please try get an account and send me some feedback.

 You can try post and edit  comments/wiki pages.

 I will reset the database in the next couple of days so do not be
 surprised if you loose your account and changes.

 I will also try port over AlterEgo data and merge with appliances.

 Massimo

 --
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.




Re: [web2py] Ladies and Gentelmen... the web2py book is online

2010-08-03 Thread Zoom.Quiet
On Fri, Feb 12, 2010 at 09:30, mdipierro mdipie...@cs.depaul.edu wrote:
 http://web2py.com/book

 This is only for testing purposes.
 Please try get an account and send me some feedback.

can not usage any account login
Invalid argument: token_url domain not in whitelist

i try google/Yahoo/openID

 You can try post and edit  comments/wiki pages.

 I will reset the database in the next couple of days so do not be
 surprised if you loose your account and changes.

 I will also try port over AlterEgo data and merge with appliances.

 Massimo

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.





-- 
http://zoomquiet.org 人生苦短? Pythonic!
attachment: zoomq-2010-08-04-014119_984x123_scrot.png

[web2py] Re: Ladies and Gentelmen... the web2py book is online

2010-08-03 Thread mdipierro
I have been working on the apps. I apologize. I am about to fix it
soon.

Massimo

On Aug 3, 12:43 pm, Zoom.Quiet zoom.qu...@gmail.com wrote:
 On Fri, Feb 12, 2010 at 09:30, mdipierro mdipie...@cs.depaul.edu wrote:
 http://web2py.com/book

  This is only for testing purposes.
  Please try get an account and send me some feedback.

 can not usage any account login
 Invalid argument: token_url domain not in whitelist

 i try google/Yahoo/openID



  You can try post and edit  comments/wiki pages.

  I will reset the database in the next couple of days so do not be
  surprised if you loose your account and changes.

  I will also try port over AlterEgo data and merge with appliances.

  Massimo

  --
  You received this message because you are subscribed to the Google Groups 
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.

 --http://zoomquiet.org人生苦短? Pythonic!

  zoomq-2010-08-04-014119_984x123_scrot.png
 39KViewDownload


[web2py] Custom dynamic form submission

2010-08-03 Thread cogarg
Hello,

I just starting using web2py and i am a little bit lost, since my
knowledge of
html/css/js/python are mediocre at best.

What i wanted to create is a form with some standard fields and an
option
to add more fields(single button, adds 6 fields - an entire db
record).

So far, so good, the html/js portion looks solid, but i can't figure
out how to
add the extra fields to the database.

I've used the following js code, which i refined from various
examples, which
also inserts a number after each and every field name, so the fields i
have to
work with are named fieldaN , ... , fieldfN .

script language=JavaScript
var items=0;
function insRow()
{
items++;
var x=document.getElementById('myTable').insertRow(-1);
var a=x.insertCell(0);
var b=x.insertCell(1);
var c=x.insertCell(2);
var d=x.insertCell(3);
var e=x.insertCell(4);
var f=x.insertCell(5);
a.innerHTML=input name=\fielda + items + \ /;
b.innerHTML=input name=\fieldb + items + \ /;
c.innerHTML=input name=\fieldc + items + \ /;
d.innerHTML=input name=\fieldd + items + \ /;
e.innerHTML=input name=\fielde + items + \ /;
f.innerHTML=input name=\fieldf + items + \ /;
}
function delRow() {
document.getElementById('myTable').deleteRow(-1)
}
/script


I know this is a very bad way to implement this, and i would
appreciate any help.


[web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread Martin.Mulone
First my appologies for my bad english, spanish is my primary
language. I was reading about GAE http://web2py.com/AlterEgo/default/show/248
. Yes i have to transform many queries :P. I have many ideas, many of
them i dont know how to implement like layouts system, layouts over
layouts, i dont think is possible, so we have a limit here, anyway i
dont go to implement it, after to be totally sure. Another thing I
dont want to create another auth users tables because exist and do the
job very well, but need some field, for example let the users upload
avatars, so i think i need to extend. Anyways i think next week i am
going to realease alpha 3, but always can check progress in
subversion.

On Aug 3, 1:17 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 Another necessary app:

 Currently , there are so few python hosting providers especially for  shared
 hosting.
 We need a Hosting Control panel for web2py.

 Even Web2py admin modifcation with different admins for each projects should
 work. But there may be security concern as web2py allows full python access.
 There is Python Virtual env for it right?

 Anyone wanna give it a shot?

 On Tue, Aug 3, 2010 at 10:41 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:



  Ok Back to Topic
  Instant Press , looks good

  With some work , that one could become a standard Blog for Web2py .

  mulone martin , you should be branding it .
  Get a domain for it as a dedicate site , and to some of us who want to
  contribute , assign task at google code.

  Prof Massimo , your reddit clone can also become a killer APP , shouln't
  you make a site dedicated for it and host it at googlecode + assign task to
  us , so we can contribute?

  googlecode have huge SEO advantage for opensource projects.

  On Tue, Aug 3, 2010 at 10:17 PM, mdipierro mdipie...@cs.depaul.eduwrote:

  This code is equivalent to yours, also runs on GAE, and it is faster:

  @staticmethod
     def searchPages(string=None,nfmessage='Nothing found with %s'):
          pages = db(db.plugin_wiki_page.id0).select().find(lambda row:
  \
                       string and (string in row.slug or string in
  row.body or string in row.title) and not row.slug.startswith('meta'))
         if pages:
             return

  UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',arg
   s=page.slug)))
  for page in pages])
         else:
             return ''

  On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
   Thats the way I found to perform LIKE() search in GAE, it is ugly (I
  know)
   but works.. I am waiting for any feature to replace this.

   @staticmethod
       def searchPages(string=None,nfmessage='Nothing found with %s'):
           
           string: string to be found
           
           found = set()
           string = request.vars.search
           if string:
               #search in slug
               pages =
   db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
               for page in pages:
                   if page.slug.find(string)  -1:
                       found.add(page.slug)

               #search in page body
               pages =
   db(db.plugin_wiki_page.id
  0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
               for page in pages:
                   if page.body.find(string)  -1:
                       found.add(page.slug)

               #search in page title
               pages =
   db(db.plugin_wiki_page.id
  0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
               for page in pages:
                   if page.title.find(string)  -1:
                       found.add(page.slug)

               if found:
                   cleanfound = set()
                   for row in found:
                       if row[:4]!='meta':
                           cleanfound.add(row)

                   return
  UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\

   .select(db.plugin_wiki_page.title)[0].title),\

   _href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
                                   for row in cleanfound])
               #r=request,f='page'
               else:
                   return nfmessage % string

           else:
               return ''

   2010/8/2 Martin.Mulone mulone.mar...@gmail.com

I use like() to search, but in a near future this could be disabled.

On Aug 2, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Running locally InstantPress looks awesome, quickly, beauty/clean
  layout
and
 I loved the way you treat Admin Buttons.

 Congratulations!

 But, this could not works on GAE, I saw a lot of code that is not
  allowed
on
 GAE, you are using .like() in get_lats_pots_with_search()

 Today I will try to run it on GAE, testing  some workarround, then I
report
 you.

 {{=thanks}}

 2010/8/2 Martin.Mulone mulone.mar...@gmail.com

  I don know I think yes, but I dont test it.

  On Aug 2, 9:45 am, Bruno 

[web2py] Re: Custom dynamic form submission

2010-08-03 Thread mdipierro
I suggest you use this:
http://muiomuio.com/web-design/add-remove-items-with-jquery

and here is a demo:
http://muiomuio.com/tutorials/jquery/add-remove/

Massimo

On Aug 3, 1:19 pm, cogarg cog...@gmail.com wrote:
 Hello,

 I just starting using web2py and i am a little bit lost, since my
 knowledge of
 html/css/js/python are mediocre at best.

 What i wanted to create is a form with some standard fields and an
 option
 to add more fields(single button, adds 6 fields - an entire db
 record).

 So far, so good, the html/js portion looks solid, but i can't figure
 out how to
 add the extra fields to the database.

 I've used the following js code, which i refined from various
 examples, which
 also inserts a number after each and every field name, so the fields i
 have to
 work with are named fieldaN , ... , fieldfN .

 script language=JavaScript
 var items=0;
 function insRow()
 {
         items++;
         var x=document.getElementById('myTable').insertRow(-1);
         var a=x.insertCell(0);
         var b=x.insertCell(1);
         var c=x.insertCell(2);
         var d=x.insertCell(3);
         var e=x.insertCell(4);
         var f=x.insertCell(5);
         a.innerHTML=input name=\fielda + items + \ /;
         b.innerHTML=input name=\fieldb + items + \ /;
         c.innerHTML=input name=\fieldc + items + \ /;
         d.innerHTML=input name=\fieldd + items + \ /;
         e.innerHTML=input name=\fielde + items + \ /;
         f.innerHTML=input name=\fieldf + items + \ /;}

 function delRow() {
     document.getElementById('myTable').deleteRow(-1)}

 /script

 I know this is a very bad way to implement this, and i would
 appreciate any help.


[web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread mdipierro
No apologies. Your work is excellent.

On Aug 3, 1:48 pm, Martin.Mulone mulone.mar...@gmail.com wrote:
 First my appologies for my bad english, spanish is my primary
 language. I was reading about GAEhttp://web2py.com/AlterEgo/default/show/248
 . Yes i have to transform many queries :P. I have many ideas, many of
 them i dont know how to implement like layouts system, layouts over
 layouts, i dont think is possible, so we have a limit here, anyway i
 dont go to implement it, after to be totally sure. Another thing I
 dont want to create another auth users tables because exist and do the
 job very well, but need some field, for example let the users upload
 avatars, so i think i need to extend. Anyways i think next week i am
 going to realease alpha 3, but always can check progress in
 subversion.

 On Aug 3, 1:17 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:

  Another necessary app:

  Currently , there are so few python hosting providers especially for  shared
  hosting.
  We need a Hosting Control panel for web2py.

  Even Web2py admin modifcation with different admins for each projects should
  work. But there may be security concern as web2py allows full python access.
  There is Python Virtual env for it right?

  Anyone wanna give it a shot?

  On Tue, Aug 3, 2010 at 10:41 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:

   Ok Back to Topic
   Instant Press , looks good

   With some work , that one could become a standard Blog for Web2py .

   mulone martin , you should be branding it .
   Get a domain for it as a dedicate site , and to some of us who want to
   contribute , assign task at google code.

   Prof Massimo , your reddit clone can also become a killer APP , shouln't
   you make a site dedicated for it and host it at googlecode + assign task 
   to
   us , so we can contribute?

   googlecode have huge SEO advantage for opensource projects.

   On Tue, Aug 3, 2010 at 10:17 PM, mdipierro mdipie...@cs.depaul.eduwrote:

   This code is equivalent to yours, also runs on GAE, and it is faster:

   @staticmethod
      def searchPages(string=None,nfmessage='Nothing found with %s'):
           pages = db(db.plugin_wiki_page.id0).select().find(lambda row:
   \
                        string and (string in row.slug or string in
   row.body or string in row.title) and not row.slug.startswith('meta'))
          if pages:
              return

   UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',arg
s=page.slug)))
   for page in pages])
          else:
              return ''

   On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
Thats the way I found to perform LIKE() search in GAE, it is ugly (I
   know)
but works.. I am waiting for any feature to replace this.

@staticmethod
    def searchPages(string=None,nfmessage='Nothing found with %s'):
        
        string: string to be found
        
        found = set()
        string = request.vars.search
        if string:
            #search in slug
            pages =
db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
            for page in pages:
                if page.slug.find(string)  -1:
                    found.add(page.slug)

            #search in page body
            pages =
db(db.plugin_wiki_page.id
   0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
            for page in pages:
                if page.body.find(string)  -1:
                    found.add(page.slug)

            #search in page title
            pages =
db(db.plugin_wiki_page.id
   0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
            for page in pages:
                if page.title.find(string)  -1:
                    found.add(page.slug)

            if found:
                cleanfound = set()
                for row in found:
                    if row[:4]!='meta':
                        cleanfound.add(row)

                return
   UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\

.select(db.plugin_wiki_page.title)[0].title),\

_href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
                                for row in cleanfound])
            #r=request,f='page'
            else:
                return nfmessage % string

        else:
            return ''

2010/8/2 Martin.Mulone mulone.mar...@gmail.com

 I use like() to search, but in a near future this could be disabled.

 On Aug 2, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  Running locally InstantPress looks awesome, quickly, beauty/clean
   layout
 and
  I loved the way you treat Admin Buttons.

  Congratulations!

  But, this could not works on GAE, I saw a lot of code that is not
   allowed
 on
  GAE, you are using .like() in get_lats_pots_with_search()

  Today I will try to run it on 

[web2py] Web2py Application Exhibition -- Winners!

2010-08-03 Thread NetAdmin
Hello All,

The winners of the Web2py Application Exhibition have been e-mailed,
and I'm waiting for their replies before posting the results.

 Mr.NetAdmin



Re: [web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread Bruno Rocha
Thanks Massimo!

I am learning a lot about the way you use lambda: in web2py.

now my search is really faster.

is there any chance to do:

myrows = db(..).select().GAELIKE('string')   or
myrows = db(...).select().like(string)   or may be
myrows = GAELIKE(db.().select(),'string')

pointing to you solution? than this could solve the problem.



I am doing this:

*Search page (meta-sidebar):*

script
$('#search').keyup(function(){
ajax({{=URL(r=request,
c='plugin_wiki',f='page.load/searchpages')}},['search'],'target');
return false;
});
/script
h2Search/h2
form
input id='search' name='search'
/form
div id='target' name='target'/div

*page/searchpages:*

``
name: searchPages
string: {{=request.args(1)}}
nfmessage: Nothing found with the word (%s)
``:widget

*the widget just as you said:*

@staticmethod
def searchPages(string=None,nfmessage='Nothing found with %s'):

string = request.vars.search
pages = db(db.plugin_wiki_page.id0).select().find(lambda row:string
and (string in row.slug or string in row.body or string in row.title) and
not row.slug.startswith('meta'))
if string:
if pages:
return 'bResults/b/br %s  ' %
UL(*[LI(A(XML(page.title),_href=URL(request.application,'plugin_wiki','page',args=page.slug)))
for page in pages])
else:
return nfmessage % string
else:
return ''


--


Sorry for going out off the post Topic Again...






2010/8/3 mdipierro mdipie...@cs.depaul.edu

 This code is equivalent to yours, also runs on GAE, and it is faster:

 @staticmethod
def searchPages(string=None,nfmessage='Nothing found with %s'):
 pages = db(db.plugin_wiki_page.id0).select().find(lambda row:
 \
  string and (string in row.slug or string in
 row.body or string in row.title) and not row.slug.startswith('meta'))
if pages:
return

 UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',args=page.slug)))
 for page in pages])
else:
return ''


 On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  Thats the way I found to perform LIKE() search in GAE, it is ugly (I
 know)
  but works.. I am waiting for any feature to replace this.
 
  @staticmethod
  def searchPages(string=None,nfmessage='Nothing found with %s'):
  
  string: string to be found
  
  found = set()
  string = request.vars.search
  if string:
  #search in slug
  pages =
  db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
  for page in pages:
  if page.slug.find(string)  -1:
  found.add(page.slug)
 
  #search in page body
  pages =
  db(db.plugin_wiki_page.id
 0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
  for page in pages:
  if page.body.find(string)  -1:
  found.add(page.slug)
 
  #search in page title
  pages =
  db(db.plugin_wiki_page.id
 0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
  for page in pages:
  if page.title.find(string)  -1:
  found.add(page.slug)
 
  if found:
  cleanfound = set()
  for row in found:
  if row[:4]!='meta':
  cleanfound.add(row)
 
  return UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\
 
  .select(db.plugin_wiki_page.title)[0].title),\
 
  _href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
  for row in cleanfound])
  #r=request,f='page'
  else:
  return nfmessage % string
 
  else:
  return ''
 
  2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 
 
   I use like() to search, but in a near future this could be disabled.
 
   On Aug 2, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
Running locally InstantPress looks awesome, quickly, beauty/clean
 layout
   and
I loved the way you treat Admin Buttons.
 
Congratulations!
 
But, this could not works on GAE, I saw a lot of code that is not
 allowed
   on
GAE, you are using .like() in get_lats_pots_with_search()
 
Today I will try to run it on GAE, testing  some workarround, then I
   report
you.
 
{{=thanks}}
 
2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 I don know I think yes, but I dont test it.
 
 On Aug 2, 9:45 am, Bruno Rocha rochacbr...@gmail.com wrote:
  Martin, is it able to work on GAE ?
 
  2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
   I am working in a cms *blog style* the idea is to be simple,
 ready
   to
   work, looking professional, and use ajax and effect in admin
 panel
   at
   least. You can see here:
  

Re: [web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread Bruno Rocha
'Bad English '*2

2010/8/3 Martin.Mulone mulone.mar...@gmail.com

 First my appologies for my bad english, spanish is my primary
 language. I was reading about GAE
 http://web2py.com/AlterEgo/default/show/248
 . Yes i have to transform many queries :P. I have many ideas, many of
 them i dont know how to implement like layouts system, layouts over
 layouts, i dont think is possible, so we have a limit here, anyway i
 dont go to implement it, after to be totally sure. Another thing I
 dont want to create another auth users tables because exist and do the
 job very well, but need some field, for example let the users upload
 avatars, so i think i need to extend. Anyways i think next week i am
 going to realease alpha 3, but always can check progress in
 subversion.

 On Aug 3, 1:17 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:
  Another necessary app:
 
  Currently , there are so few python hosting providers especially for
  shared
  hosting.
  We need a Hosting Control panel for web2py.
 
  Even Web2py admin modifcation with different admins for each projects
 should
  work. But there may be security concern as web2py allows full python
 access.
  There is Python Virtual env for it right?
 
  Anyone wanna give it a shot?
 
  On Tue, Aug 3, 2010 at 10:41 PM, Phyo Arkar phyo.arkarl...@gmail.com
 wrote:
 
 
 
   Ok Back to Topic
   Instant Press , looks good
 
   With some work , that one could become a standard Blog for Web2py .
 
   mulone martin , you should be branding it .
   Get a domain for it as a dedicate site , and to some of us who want to
   contribute , assign task at google code.
 
   Prof Massimo , your reddit clone can also become a killer APP ,
 shouln't
   you make a site dedicated for it and host it at googlecode + assign
 task to
   us , so we can contribute?
 
   googlecode have huge SEO advantage for opensource projects.
 
   On Tue, Aug 3, 2010 at 10:17 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
 
   This code is equivalent to yours, also runs on GAE, and it is faster:
 
   @staticmethod
  def searchPages(string=None,nfmessage='Nothing found with %s'):
   pages = db(db.plugin_wiki_page.id0).select().find(lambda
 row:
   \
string and (string in row.slug or string in
   row.body or string in row.title) and not row.slug.startswith('meta'))
  if pages:
  return
 
  
 UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',arg
 s=page.slug)))
   for page in pages])
  else:
  return ''
 
   On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
Thats the way I found to perform LIKE() search in GAE, it is ugly (I
   know)
but works.. I am waiting for any feature to replace this.
 
@staticmethod
def searchPages(string=None,nfmessage='Nothing found with %s'):

string: string to be found

found = set()
string = request.vars.search
if string:
#search in slug
pages =
db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
for page in pages:
if page.slug.find(string)  -1:
found.add(page.slug)
 
#search in page body
pages =
db(db.plugin_wiki_page.id
   0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
for page in pages:
if page.body.find(string)  -1:
found.add(page.slug)
 
#search in page title
pages =
db(db.plugin_wiki_page.id
   0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
for page in pages:
if page.title.find(string)  -1:
found.add(page.slug)
 
if found:
cleanfound = set()
for row in found:
if row[:4]!='meta':
cleanfound.add(row)
 
return
   UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\
 
.select(db.plugin_wiki_page.title)[0].title),\
 
_href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
for row in cleanfound])
#r=request,f='page'
else:
return nfmessage % string
 
else:
return ''
 
2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 I use like() to search, but in a near future this could be
 disabled.
 
 On Aug 2, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  Running locally InstantPress looks awesome, quickly,
 beauty/clean
   layout
 and
  I loved the way you treat Admin Buttons.
 
  Congratulations!
 
  But, this could not works on GAE, I saw a lot of code that is
 not
   allowed
 on
  GAE, you are using .like() in get_lats_pots_with_search()
 
  Today I will try to run it on 

Re: [web2py] Re: A Call to Arms - Necessary and KILLER Apps for Web2py

2010-08-03 Thread Bruno Rocha
'Bad English'*2 ... I mean my english is worse than yours.

 your method get_last_post_with_search()  can be replaces with the solution
using .find() posted here,
now we have to find ways to port use the not operators (!= and ~)  and
mixed queries (db.image.id==id)(db.image.title=='').

Image upload is also a problem, I have no sucess when trying to download an
image from GAE Blob.



2010/8/3 Martin.Mulone mulone.mar...@gmail.com

 First my appologies for my bad english, spanish is my primary
 language. I was reading about GAE
 http://web2py.com/AlterEgo/default/show/248
 . Yes i have to transform many queries :P. I have many ideas, many of
 them i dont know how to implement like layouts system, layouts over
 layouts, i dont think is possible, so we have a limit here, anyway i
 dont go to implement it, after to be totally sure. Another thing I
 dont want to create another auth users tables because exist and do the
 job very well, but need some field, for example let the users upload
 avatars, so i think i need to extend. Anyways i think next week i am
 going to realease alpha 3, but always can check progress in
 subversion.

 On Aug 3, 1:17 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:
  Another necessary app:
 
  Currently , there are so few python hosting providers especially for
  shared
  hosting.
  We need a Hosting Control panel for web2py.
 
  Even Web2py admin modifcation with different admins for each projects
 should
  work. But there may be security concern as web2py allows full python
 access.
  There is Python Virtual env for it right?
 
  Anyone wanna give it a shot?
 
  On Tue, Aug 3, 2010 at 10:41 PM, Phyo Arkar phyo.arkarl...@gmail.com
 wrote:
 
 
 
   Ok Back to Topic
   Instant Press , looks good
 
   With some work , that one could become a standard Blog for Web2py .
 
   mulone martin , you should be branding it .
   Get a domain for it as a dedicate site , and to some of us who want to
   contribute , assign task at google code.
 
   Prof Massimo , your reddit clone can also become a killer APP ,
 shouln't
   you make a site dedicated for it and host it at googlecode + assign
 task to
   us , so we can contribute?
 
   googlecode have huge SEO advantage for opensource projects.
 
   On Tue, Aug 3, 2010 at 10:17 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
 
   This code is equivalent to yours, also runs on GAE, and it is faster:
 
   @staticmethod
  def searchPages(string=None,nfmessage='Nothing found with %s'):
   pages = db(db.plugin_wiki_page.id0).select().find(lambda
 row:
   \
string and (string in row.slug or string in
   row.body or string in row.title) and not row.slug.startswith('meta'))
  if pages:
  return
 
  
 UL(*[LI(A(page.title,_href=URL(request.application,'plugin_wiki','page',arg
 s=page.slug)))
   for page in pages])
  else:
  return ''
 
   On Aug 2, 4:59 pm, Bruno Rocha rochacbr...@gmail.com wrote:
Thats the way I found to perform LIKE() search in GAE, it is ugly (I
   know)
but works.. I am waiting for any feature to replace this.
 
@staticmethod
def searchPages(string=None,nfmessage='Nothing found with %s'):

string: string to be found

found = set()
string = request.vars.search
if string:
#search in slug
pages =
db(db.plugin_wiki_page.id0).select(db.plugin_wiki_page.slug)
for page in pages:
if page.slug.find(string)  -1:
found.add(page.slug)
 
#search in page body
pages =
db(db.plugin_wiki_page.id
   0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.body)
for page in pages:
if page.body.find(string)  -1:
found.add(page.slug)
 
#search in page title
pages =
db(db.plugin_wiki_page.id
   0).select(db.plugin_wiki_page.slug,db.plugin_wiki_page.title)
for page in pages:
if page.title.find(string)  -1:
found.add(page.slug)
 
if found:
cleanfound = set()
for row in found:
if row[:4]!='meta':
cleanfound.add(row)
 
return
   UL(*[LI(*[A(XML(db(db.plugin_wiki_page.slug==row)\
 
.select(db.plugin_wiki_page.title)[0].title),\
 
_href=URL(request.application,'plugin_wiki','page',args=[row,]))])\
for row in cleanfound])
#r=request,f='page'
else:
return nfmessage % string
 
else:
return ''
 
2010/8/2 Martin.Mulone mulone.mar...@gmail.com
 
 I use like() to search, but in a near future this could be
 disabled.
 
 On Aug 2, 1:23 pm, Bruno Rocha 

[web2py] Is it possible to close the source of an app made with plugin_wiki?

2010-08-03 Thread Bruno Rocha
I saw this post -  So ... you want to make and sell a closed source
windows exe web2py app? Http://bit.ly/aNWRgi

And I was thinking, if it is possible to package an application developed
with plugin_wiki and distribute closed source?

I am not sure how this works internally, but since the plugin_wiki executes
code that can be stored in database, within meta-pages, and template widget.

Is it possible to package parts of the application and still perform the
meta codes at run-time?

Just curious.


[web2py] Best practice for removing link to active page from menu?

2010-08-03 Thread mwolfe02
I wrote this simple website using Django (http://
www.heberlings.com/).  As part of the navigation, I wanted to turn off
the link for the currently active page.  If you visit the site and
click on a couple of the menu items on the left side of the page, you
will see what I mean.

To implement this in Django, I did the following in my base.html view
(or as Django calls it, template):

!-- Start of left-hand side navigation --
{% url heb-home as url_home %}
{% url heb-info as url_info %}
...
div id=nav
  ul
{% ifequal request.path url_home %}
 li id=currentHome/li
{% else %}
 lia href={{ url_home }}Home/a/li
{% endifequal %}
{% ifequal request.path url_info %}
 li id=currentStore Information/li
{% else %}
 lia href={{ url_info }}Store Information/a/li
{% endifequal %}
...

I always felt this was kludgy and I had trouble getting it to work
just right.  (Note: I did this a couple of years ago, things may have
changed in Django since then.)


My question is this:  how would I do this sort of thing in web2py?
Should I implement this in models/menu.py?  What is the best practice?


Thanks in advance,
Mike


[web2py] accessing the db from a module

2010-08-03 Thread sethford
Is there is a way to access the db from a module? I know you can
import the DAL from looking at:

http://groups.google.com/group/web2py/browse_thread/thread/a78a04016d0dd737/d0e4792976294ec6?show_docid=d0e4792976294ec6

but it appears this only works to create a new db altogether and I
would like to have access to the same db I use in my controllers. Am I
just doing this wrong or is there another way to do it?


Re: [web2py] accessing the db from a module

2010-08-03 Thread Thadeus Burgess
The only way is if you pass the dal instance as an argument to your
function calls.

do_something(db)

a_class = MyClass(db, request, response)

--
Thadeus





On Tue, Aug 3, 2010 at 6:04 PM, sethford sethfor...@gmail.com wrote:
 Is there is a way to access the db from a module? I know you can
 import the DAL from looking at:

 http://groups.google.com/group/web2py/browse_thread/thread/a78a04016d0dd737/d0e4792976294ec6?show_docid=d0e4792976294ec6

 but it appears this only works to create a new db altogether and I
 would like to have access to the same db I use in my controllers. Am I
 just doing this wrong or is there another way to do it?



[web2py] crud + custom form broken?

2010-08-03 Thread Rob
web2py Version 1.81.5 (2010-07-22 23:56:21)

def index():
rows = db().select(db.Dinners.ALL)
form = crud.select(db.Dinners)
return dict(form=form, rows=rows)

default/index.html:
{{extend 'layout.html'}}

{{=form.custom.begin}}
{{=form.custom.end}}

Results in:
Traceback (most recent call last):
  File /home/rhd/Desktop/web2py/gluon/restricted.py, line 178, in
restricted
exec ccode in environment
  File /home/rhd/Desktop/web2py/applications/NerdDinner/views/default/
index.html, line 60, in module
AttributeError: 'SQLTABLE' object has no attribute 'custom'

What am I doing wrong?


Re: [web2py] crud + custom form broken?

2010-08-03 Thread Thadeus Burgess
crud.select is not a form. it is an SQLTABLE. You probably ment, form
= crud.create(db.Dinners), or form = crud.update(db.Dinners, id)

--
Thadeus





On Tue, Aug 3, 2010 at 10:16 PM, Rob r...@rmdashr.com wrote:
 web2py Version 1.81.5 (2010-07-22 23:56:21)

 def index():
    rows = db().select(db.Dinners.ALL)
    form = crud.select(db.Dinners)
    return dict(form=form, rows=rows)

 default/index.html:
 {{extend 'layout.html'}}

 {{=form.custom.begin}}
 {{=form.custom.end}}

 Results in:
 Traceback (most recent call last):
  File /home/rhd/Desktop/web2py/gluon/restricted.py, line 178, in
 restricted
    exec ccode in environment
  File /home/rhd/Desktop/web2py/applications/NerdDinner/views/default/
 index.html, line 60, in module
 AttributeError: 'SQLTABLE' object has no attribute 'custom'

 What am I doing wrong?



Re: [web2py] Re: plugin_wiki suggestions

2010-08-03 Thread Bruno Rocha
Useful suggestion:

markmin currently does not allow the creation of references to links, this
is very useful when the written material might be used for printing as
well. thus present a list of links referenced in the footnote.

with markdown, we can do:
This is [an example] [id] reference-style link.
Then, anywhere in the document, you define your link label like this, on a
line by Itself:
[Id]: http://example.com/ Optional Title Here



2010/8/1 mdipierro mdipie...@cs.depaul.edu

 Not yet. You can post here for now. Not sure it needs a new place.

 If you have comments please send them asap since I am about to make
 some changes and write a book chapter about it tomorrow.

 On 1 Ago, 04:55, Bruno Rocha rochacbr...@gmail.com wrote:
  Sorry again, I am creating a new thread about plugin_wiki.
 
  I wonder if there is any public place where we can write suggestions,
  criticisms, and send questions exclusively about plugin_wiki, markmin and
  cube2py?
 
  --
 
  http://rochacbruno.com.br




-- 

http://rochacbruno.com.br