Re: [web2py] Re: cube2py news

2010-08-04 Thread Bruno Rocha
I found a trick to do that

as #anchor marked with [[anything]] is rendered as pspan
id='anything'/span/p ( which I am not sure if it is a good html pratice
)

BTW, I solved my problem on white spaces with CSS

[[br]] = span id=br I want br /
[[brbr]] = span id=brbr I want br /br /
plus
[[hr]] = span id=hr I want hr

the CSS

#br{
height:15px;
line-height:15px;
display:block;
}
#brbr{
height:30px;
line-height:15px;
display:block;
}
#hr{
width:100%;
height:2px;
border-top: 1px solid black;
display:block;
}

I also modified markin.py to render br just for curiosity, but I decide to
stay with only CSS

regex_br = re.compile('\[\[\sbr\s\]\]')  and [[ br ]] is rendered as br by
defining text = regex_br.sub('br')



2010/7/13 mdipierro mdipie...@cs.depaul.edu

 You can override the default behavior, just set in db.py

 plugin_wiki_editor = . your condition 

 You cannot insert white spaces in markmin unless you do

  `` ``:template

 but it is horrible.

 On 13 Lug, 17:07, Chris S sanders.ch...@gmail.com wrote:
  Ah great, you're correct GAE does not start at id==1 (or it doesn't
  guarantee it).
 
  Any chance we could make the 'editor' group a variable so that when
  importing it into existing applications we can set the name to be that
  of an already created 'admin' group?
  Another thing I've been doing recently is to make the {{extend
  'layout.html'}} in all of the views a varriable.  This lets me easily
  swap to a different layout with out having to rename files, or even
  swap on the fly.  I can manually do this but it might be something
  worth putting into the files.  It could just be set with the other
  'required' globals to default to 'layout.html'.
 
  This looks really great I love the storing of pages in a DB and the
  auto-history tracking.  How do I go about inserting page breaks /br
  or white space in markmin?  So far that's the only thing making me
  want to stick to WYSIWYG editing in HTML, though I like the look of
  markmin.
 
  On Jul 13, 4:06 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 
   The first user (id==1) is editor by default (but not on GAE). Create a
   group with role='editor' and make yourself member using appadmin.
 
   On 13 Lug, 13:11, Chris S sanders.ch...@gmail.com wrote:
 
Ah it's an authorization thing.
 
I can get myself to the the index page now, but I'm still not sure
 how
I make myself a 'plugin_wiki_editor' I tried creating a group of that
name and using appadmin to add my login to that group but that didn't
work.  Maybe I'm missing something easy, or maybe the first
 registered
user needs to become an 'editor'?  I'm not sure how anyone gets to be
an editor if you have to first be one to assign the rights...
 
On Jul 13, 12:42 pm, Chris S sanders.ch...@gmail.com wrote:
 
 I also meant to ask, does plugin_wiki just come with cube2py?  Can
 it
 also be downloaded somewhere separately?
 I thought it could, but I can't find it anwywhere.  Can someone
 point
 me to where plugin_wiki is?
 
 On Jul 13, 12:39 pm, Chris S sanders.ch...@gmail.com wrote:
 
  I just loaded the latest trunk, and the latest cube2py at:
 https://cube2py.googlecode.com/hg/cube2py
 
  I cleared the datastore and memcache then pointed my browser to
  127.0.0.1:8080/cube2py
 
  I get the login screen, but when I try to register I get a 404.
  The
  entire log from the initial page view to the redirect to home is
 shown
  below.
  Am I using the correct location for the cube2py repository?
 
  --Complete Log--
  INFO 2010-07-13 17:35:46,755 gaehandler.py:57]  Request:
  25.00ms/25.65ms (real time/cpu time)
  INFO 2010-07-13 17:35:46,780 dev_appserver.py:3268] GET
 /cube2py
  HTTP/1.1 303 -
  INFO 2010-07-13 17:35:46,835 gaehandler.py:57]  Request:
  23.00ms/23.60ms (real time/cpu time)
  INFO 2010-07-13 17:35:46,862 dev_appserver.py:3268] GET
 /cube2py/
  plugin_wiki/page/home HTTP/1.1 303 -
  INFO 2010-07-13 17:35:46,921 gaehandler.py:57]  Request:
  27.00ms/26.93ms (real time/cpu time)
  INFO 2010-07-13 17:35:46,947 dev_appserver.py:3268] GET
 /cube2py/
  default/user/login HTTP/1.1 200 -
  ERROR2010-07-13 17:35:47,092 dev_appserver.py:2633] Error
  encountered reading file C:\Users\chris.sanders\Documents\Misc
  \workspace\WebDev\applications/cube2py/static/echo/images/ddd-
  gradient.jpg:
  [Errno 2] No such file or directory: 'C:\\Users\\chris.sanders\
 
 \Documents\\Misc\\workspace\\WebDev\\applications/cube2py/static/echo/
  images/ddd-gradient.jpg'
  INFO 2010-07-13 17:35:47,118 dev_appserver.py:3268] GET
 /cube2py/
  static/echo/images/ddd-gradient.jpg HTTP/1.1 404 -
  INFO 2010-07-13 17:35:51,035 gaehandler.py:57]  Request:
  29.00ms/28.97ms (real time/cpu time)
  INFO 2010-07-13 17:35:51,062 dev_appserver.py:3268] GET
 /cube2py/
 

[web2py] Re: crud + custom form broken?

2010-08-04 Thread Rob
Duh...  thanks a lot Thadeus!

I'm glad the people in this group are as helpful and understanding as
they are :)

On Aug 3, 9:10 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 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?


[web2py] Re: Web2py Application Exhibition -- Winners!

2010-08-04 Thread mdipierro
Can you post some stats?
Number of participants for example.

Massimo

On Aug 3, 2:01 pm, NetAdmin mr.netad...@gmail.com wrote:
 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


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

2010-08-04 Thread mdipierro
You can do
myrows = gaelike(db.().select(),text)

if you define:

def gaelike(rows,text):
  def condition(row):
return len([k for k,v in row.items() if isinstance(v,str)
and text in v])0
  return rows.find(condition)


On Aug 3, 2:53 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 '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,]))])\
              

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

2010-08-04 Thread mdipierro
Yes. The only issue here is that plugin_wiki has triple license,
including BSD therefore your closed source app must say it is based on
plugin wiki.

On Aug 3, 4:15 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 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] Re: Best practice for removing link to active page from menu?

2010-08-04 Thread mdipierro
The ul.../ul code in Django in web2py translates with

{{=MENU(response.menu)}}

where (using the data in your example)

response.menu=[
  ('Home',request.function=='home',URL(r=request,f='home'),[]),
  ('Store Information',request.function=='info',URL(r=request,f=info'),
[]),
]

The latter code can go in menu.py but you can place it in any mode.
MENU(...) takes arguments that allows you to customize the class of
the ul amd li. It also handles submenu (the [] above are
submenus).

On Aug 3, 4:38 pm, mwolfe02 michael.joseph.wo...@gmail.com wrote:
 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] Re: How to detect in controller that request is via AJAX?

2010-08-04 Thread mdipierro
thanks uploading


On Aug 3, 4:46 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Aug 3, 2010, at 7:48 AM, Jonathan Lundell wrote:



  On Aug 3, 2010, at 5:33 AM, Niphlod wrote:

  +1 for this method, is pretty standard in other frameworks too.
  Also, according tohttp://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...

 Idle thought (slow afternoon): str(request.env.http_x_requested_with).lower() 
 == 'xmlhttprequest'


[web2py] Re: plugin_wiki suggestions

2010-08-04 Thread mdipierro
Yes you can:

[[my reference #id1]]

[[id1]] referenced material

On Aug 3, 11:56 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 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


[web2py] Re: plugin_wiki suggestions

2010-08-04 Thread mdipierro
Please check the cube2py on google code.

I did not fix the problem with the error but now template=None should
not appear anymore.

On Aug 3, 10:48 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Thanks Massimo,

 template function is very well, but raises an error ticket when passing
 'None'  in http:.../template=None, as you can see in file attached.

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



  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 

[web2py] this must be asked a 1000 times, but I couldn't find the answer

2010-08-04 Thread Stef Mientki
 please forgive my ignorance,
but I wonder why views are not written in Python, instead of html ( see 
comparison below of te first
part of default\index.html.

The advantage of using Python:
- the user can stick to 1 language
- no redundant information in the closing tags, like ul , /ul
- most editors checks the closing brackets
- normal indentation, no problems with missing pass
The disavantages of using Python:
- ???

thanks,
Stef Mientki

# ***
extend ( 'layout.html' )

if 'message' in globals () :
  H2 ( message )
else:
  DISPLAY ( BEAUTIFY ( response._vars ) )


HR ()
H1 ( 'README' )
UL (
  LI ( T ( 'You are successfully running web2py' ) ),
  LI ( T ( 'This is a copy of the scaffolding application' ) ),
  LI ( T ( 'You can modify this application and adapt it to your needs' ) ),
  LI ( T ( A ( B ( T ( click here for the administrative interface)),
  _HREF ( URL ( 'admin', 'default', 'index' ) ) ) ) ),
  LI ( A ( T ( click here for online examples),
   _HREF ( URL ( 'examples', 'default', 'index' ) ) ) ),
  LI ( HREF ( http://web2py.com;, 'web2py.com' ) ),
  LI ( HREF ( http://web2py.com/book;, T ( 'documentation' ) ) ) )

# ***
{{extend 'layout.html'}}

{{if 'message' in 
globals():}}{{=H2(message)}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}

hr /
h1README/h1
ul
  li{{=T('You are successfully running web2py')}}/li
  li{{=T('This is a copy of the scaffolding application')}}/li
  li{{=T('You can modify this application and adapt it to your needs')}}/li
  li{{=A(B(T(click here for the administrative interface)),
_href=URL('admin','default','index'))}}/li
  li{{=A(T(click here for online examples), 
_href=URL('examples','default','index'))}}/li
  lia href=http://web2py.com;web2py.com/a/li
  lia href=http://web2py.com/book;{{=T('documentation')}}/a/li
/ul



Re: [web2py] this must be asked a 1000 times, but I couldn't find the answer

2010-08-04 Thread Alexey Nezhdanov
You are free to write it the way you want. You don't you do that?
{{=DIV(HR(),H1('README'),UL(LI(T('blah'}}
I think, though, that using wrappers gives lower perfomance so you'll be
consuming more CPU.
Otherwise - no objections to your method.

On Wed, Aug 4, 2010 at 12:39 PM, Stef Mientki stef.mien...@gmail.comwrote:

  please forgive my ignorance,
 but I wonder why views are not written in Python, instead of html ( see
 comparison below of te first
 part of default\index.html.

 The advantage of using Python:
 - the user can stick to 1 language
 - no redundant information in the closing tags, like ul , /ul
 - most editors checks the closing brackets
 - normal indentation, no problems with missing pass
 The disavantages of using Python:
 - ???

 thanks,
 Stef Mientki

 # ***
 extend ( 'layout.html' )

 if 'message' in globals () :
  H2 ( message )
 else:
  DISPLAY ( BEAUTIFY ( response._vars ) )


 HR ()
 H1 ( 'README' )
 UL (
  LI ( T ( 'You are successfully running web2py' ) ),
  LI ( T ( 'This is a copy of the scaffolding application' ) ),
  LI ( T ( 'You can modify this application and adapt it to your needs' ) ),
  LI ( T ( A ( B ( T ( click here for the administrative interface)),
  _HREF ( URL ( 'admin', 'default', 'index' ) ) ) ) ),
  LI ( A ( T ( click here for online examples),
   _HREF ( URL ( 'examples', 'default', 'index' ) ) ) ),
  LI ( HREF ( http://web2py.com;, 'web2py.com' ) ),
  LI ( HREF ( http://web2py.com/book;, T ( 'documentation' ) ) ) )

 # ***
 {{extend 'layout.html'}}

 {{if 'message' in
 globals():}}{{=H2(message)}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}

 hr /
 h1README/h1
 ul
  li{{=T('You are successfully running web2py')}}/li
  li{{=T('This is a copy of the scaffolding application')}}/li
  li{{=T('You can modify this application and adapt it to your
 needs')}}/li
  li{{=A(B(T(click here for the administrative interface)),
 _href=URL('admin','default','index'))}}/li
  li{{=A(T(click here for online examples),
 _href=URL('examples','default','index'))}}/li
  lia href=http://web2py.com;web2py.com/a/li
  lia href=http://web2py.com/book;{{=T('documentation')}}/a/li
 /ul




[web2py] Re: this must be asked a 1000 times, but I couldn't find the answer

2010-08-04 Thread mdipierro
This is a good point.

to do it with the current web2py the code at best would look like
this:



Stef Mientki
View profile   Translate to Translated (View Original)
 More options Aug 4, 3:39 am
From: Stef Mientki stef.mien...@gmail.com
Date: Wed, 04 Aug 2010 10:39:48 +0200
Local: Wed, Aug 4 2010 3:39 am
Subject: this must be asked a 1000 times, but I couldn't find the
answer
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this author
 please forgive my ignorance,
but I wonder why views are not written in Python, instead of html
( see comparison below of te first
part of default\index.html.

The advantage of using Python:
- the user can stick to 1 language
- no redundant information in the closing tags, like ul , /ul
- most editors checks the closing brackets
- normal indentation, no problems with missing pass
The disavantages of using Python:
- ???

thanks,
Stef Mientki

{{extend  'layout.html' }}
{{
if 'message' in globals () :
  =H2 ( message )
else:
  =BEAUTIFY ( response._vars )
pass

= HR ()
= H1 ( 'README' )
= UL (
  LI ( T ( 'You are successfully running web2py' ) ),
  LI ( T ( 'This is a copy of the scaffolding application' ) ),
  LI ( T ( 'You can modify this application and adapt it to your
needs' ) ),
  LI ( T ( A ( B ( T ( click here for the administrative
interface)),
  __href = URL ( 'admin', 'default', 'index' ) ) )) ),
  LI ( A ( T ( click here for online examples),
   _href = URL ( 'examples', 'default', 'index' ) ) ),
  '...')
}}

I.e.
- extend, include, block and pieces of code must be between different
sets {{...}}.
- printed values must have the = prefix
- close blocks with pass

Removing completely the {{...}} and = would require some changes in
the template system.
I guess it could be an option.


On Aug 4, 3:39 am, Stef Mientki stef.mien...@gmail.com wrote:
  please forgive my ignorance,
 but I wonder why views are not written in Python, instead of html ( see 
 comparison below of te first
 part of default\index.html.

 The advantage of using Python:
 - the user can stick to 1 language
 - no redundant information in the closing tags, like ul , /ul
 - most editors checks the closing brackets
 - normal indentation, no problems with missing pass
 The disavantages of using Python:
 - ???

 thanks,
 Stef Mientki

 # ***
 extend ( 'layout.html' )

 if 'message' in globals () :
   H2 ( message )
 else:
   DISPLAY ( BEAUTIFY ( response._vars ) )

 HR ()
 H1 ( 'README' )
 UL (
   LI ( T ( 'You are successfully running web2py' ) ),
   LI ( T ( 'This is a copy of the scaffolding application' ) ),
   LI ( T ( 'You can modify this application and adapt it to your needs' ) ),
   LI ( T ( A ( B ( T ( click here for the administrative interface)),
               _HREF ( URL ( 'admin', 'default', 'index' ) ) ) ) ),
   LI ( A ( T ( click here for online examples),
            _HREF ( URL ( 'examples', 'default', 'index' ) ) ) ),
   LI ( HREF ( http://web2py.com;, 'web2py.com' ) ),
   LI ( HREF ( http://web2py.com/book;, T ( 'documentation' ) ) ) )

 # ***
 {{extend 'layout.html'}}

 {{if 'message' in 
 globals():}}{{=H2(message)}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}

 hr /
 h1README/h1
 ul
   li{{=T('You are successfully running web2py')}}/li
   li{{=T('This is a copy of the scaffolding application')}}/li
   li{{=T('You can modify this application and adapt it to your 
 needs')}}/li
   li{{=A(B(T(click here for the administrative interface)),
 _href=URL('admin','default','index'))}}/li
   li{{=A(T(click here for online examples), 
 _href=URL('examples','default','index'))}}/li
   lia href=http://web2py.com;web2py.com/a/li
   lia href=http://web2py.com/book;{{=T('documentation')}}/a/li
 /ul


Re: [web2py] Re: this must be asked a 1000 times, but I couldn't find the answer

2010-08-04 Thread Phyo Arkar
Current way is good enough , it gives programmers choices.
Many of us want to code in HTML as Long as they are static
.
May be pure python templating system which can be enable from response.view

On Wed, Aug 4, 2010 at 3:40 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 This is a good point.

 to do it with the current web2py the code at best would look like
 this:



 Stef Mientki
 View profile   Translate to Translated (View Original)
 More options Aug 4, 3:39 am
 From: Stef Mientki stef.mien...@gmail.com
 Date: Wed, 04 Aug 2010 10:39:48 +0200
 Local: Wed, Aug 4 2010 3:39 am
 Subject: this must be asked a 1000 times, but I couldn't find the
 answer
 Reply | Reply to author | Forward | Print | Individual message | Show
 original | Remove | Report this message | Find messages by this author
  please forgive my ignorance,
 but I wonder why views are not written in Python, instead of html
 ( see comparison below of te first
 part of default\index.html.

 The advantage of using Python:
 - the user can stick to 1 language
 - no redundant information in the closing tags, like ul , /ul
 - most editors checks the closing brackets
 - normal indentation, no problems with missing pass
 The disavantages of using Python:
 - ???

 thanks,
 Stef Mientki

 {{extend  'layout.html' }}
 {{
 if 'message' in globals () :
  =H2 ( message )
 else:
   =BEAUTIFY ( response._vars )
 pass

 = HR ()
 = H1 ( 'README' )
 = UL (
  LI ( T ( 'You are successfully running web2py' ) ),
  LI ( T ( 'This is a copy of the scaffolding application' ) ),
  LI ( T ( 'You can modify this application and adapt it to your
 needs' ) ),
  LI ( T ( A ( B ( T ( click here for the administrative
 interface)),
   __href = URL ( 'admin', 'default', 'index' ) ) )) ),
   LI ( A ( T ( click here for online examples),
_href = URL ( 'examples', 'default', 'index' ) ) ),
  '...')
 }}

 I.e.
 - extend, include, block and pieces of code must be between different
 sets {{...}}.
 - printed values must have the = prefix
 - close blocks with pass

 Removing completely the {{...}} and = would require some changes in
 the template system.
 I guess it could be an option.


 On Aug 4, 3:39 am, Stef Mientki stef.mien...@gmail.com wrote:
   please forgive my ignorance,
  but I wonder why views are not written in Python, instead of html ( see
 comparison below of te first
  part of default\index.html.
 
  The advantage of using Python:
  - the user can stick to 1 language
  - no redundant information in the closing tags, like ul , /ul
  - most editors checks the closing brackets
  - normal indentation, no problems with missing pass
  The disavantages of using Python:
  - ???
 
  thanks,
  Stef Mientki
 
  # ***
  extend ( 'layout.html' )
 
  if 'message' in globals () :
H2 ( message )
  else:
DISPLAY ( BEAUTIFY ( response._vars ) )
 
  HR ()
  H1 ( 'README' )
  UL (
LI ( T ( 'You are successfully running web2py' ) ),
LI ( T ( 'This is a copy of the scaffolding application' ) ),
LI ( T ( 'You can modify this application and adapt it to your needs' )
 ),
LI ( T ( A ( B ( T ( click here for the administrative interface)),
_HREF ( URL ( 'admin', 'default', 'index' ) ) ) ) ),
LI ( A ( T ( click here for online examples),
 _HREF ( URL ( 'examples', 'default', 'index' ) ) ) ),
LI ( HREF ( http://web2py.com;, 'web2py.com' ) ),
LI ( HREF ( http://web2py.com/book;, T ( 'documentation' ) ) ) )
 
  # ***
  {{extend 'layout.html'}}
 
  {{if 'message' in
 globals():}}{{=H2(message)}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}
 
  hr /
  h1README/h1
  ul
li{{=T('You are successfully running web2py')}}/li
li{{=T('This is a copy of the scaffolding application')}}/li
li{{=T('You can modify this application and adapt it to your
 needs')}}/li
li{{=A(B(T(click here for the administrative interface)),
  _href=URL('admin','default','index'))}}/li
li{{=A(T(click here for online examples),
 _href=URL('examples','default','index'))}}/li
lia href=http://web2py.com;web2py.com/a/li
lia href=http://web2py.com/book;{{=T('documentation')}}/a/li
  /ul



[web2py] How to define DAL query to retrieve items and theirs tags

2010-08-04 Thread David Marko
How to define DAL query to retrieve items and theirs tags? I have
following tables:

'message'  -- 'tagging'(maty-to-many between message and tag tables)
--- 'tag'

How to retrieve list of all mesages and their assotiated tags so I can
list messages in a view like this:
1. message text 01  (tags: tag01, tag03)
2. message text 02  (tags: tag03, tag05, tag06)
etc.

I looked to web2py book to 'One to Many Relation' examples but they
returns items in a way that gives me result like this:
1. message text 01 (tags: tag01)
2. message text 01 (tags: tag03)
3. message text 02 (tags: tag03)
4. message text 02 (tags: tag05)
5. message text 02 (tags: tag06)

There must be something I missed.
David


[web2py] Re: How to define DAL query to retrieve items and theirs tags

2010-08-04 Thread David Marko
And how do you solve this in general? It seems to me very common
thing. How to do it to minimalize database queries?  (iIm not a SQL
guy, my Job is Lotus Notes development) and recently I did project
with MongoDB, which has quite different approach for this case)

David

On 4 srp, 11:29, mdipierro mdipie...@cs.depaul.edu wrote:
 The problem is that there is no SQL query that allows you to return
 something like this. Once you get

 returns items in a way that gives me result like this:
 1. message text 01 (tags: tag01)
 2. message text 01 (tags: tag03)
 3. message text 02 (tags: tag03)
 4. message text 02 (tags: tag05)
 5. message text 02 (tags: tag06)

 you have to group them into message + list of tags programmatically

 On Aug 4, 4:25 am, David Marko dma...@tiscali.cz wrote:



  How to define DAL query to retrieve items and theirs tags? I have
  following tables:

  'message'  -- 'tagging'(maty-to-many between message and tag tables)
  --- 'tag'

  How to retrieve list of all mesages and their assotiated tags so I can
  list messages in a view like this:
  1. message text 01  (tags: tag01, tag03)
  2. message text 02  (tags: tag03, tag05, tag06)
  etc.

  I looked to web2py book to 'One to Many Relation' examples but they
  returns items in a way that gives me result like this:
  1. message text 01 (tags: tag01)
  2. message text 01 (tags: tag03)
  3. message text 02 (tags: tag03)
  4. message text 02 (tags: tag05)
  5. message text 02 (tags: tag06)

  There must be something I missed.
  David


[web2py] Re: Custom dynamic form submission

2010-08-04 Thread cogarg
Thanks for the reply, i will look into replacing the add/remove
functions with that jquery code, but i('ll) still have the same
issue;
I can't figure out how to make a controller that will process the
whole form and insert all the fields in a database.

I'm trying to write a loop to manually insert each set of fields to
the database if form.vars.fieldaN is not empty, but i still can't make
it work...

On Aug 3, 9:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 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: How to define DAL query to retrieve items and theirs tags

2010-08-04 Thread mdipierro
That is a difference between NoSQL and RDBS.

In web2py you can do it with one query+code but I would to it with
three queries and cache:

query = db.message.id0
tags_d = db(db.tag.id0).select(cache=(cache.ram,600)).as_dict()
message_d = db(query).select().as_dict()
links = db(db.tagging.message.belongs(message_d.keys()).select()
rows=[]
for link in links:
 if rows and rows[-1][0].id==link.tagging.message:
 tags=rows[-1][1]
 else:
 tags=[]
 rows.append((message_d[link.tagging.message],tags))
 if link.tagging.tag: tags.append(tags_d[link.tagging.tag])

for row in rows:
 print 'message object:', row[0], 'list of tags', row[1]

On Aug 4, 4:38 am, David Marko dma...@tiscali.cz wrote:
 And how do you solve this in general? It seems to me very common
 thing. How to do it to minimalize database queries?  (iIm not a SQL
 guy, my Job is Lotus Notes development) and recently I did project
 with MongoDB, which has quite different approach for this case)

 David

 On 4 srp, 11:29, mdipierro mdipie...@cs.depaul.edu wrote:

  The problem is that there is no SQL query that allows you to return
  something like this. Once you get

  returns items in a way that gives me result like this:
  1. message text 01 (tags: tag01)
  2. message text 01 (tags: tag03)
  3. message text 02 (tags: tag03)
  4. message text 02 (tags: tag05)
  5. message text 02 (tags: tag06)

  you have to group them into message + list of tags programmatically

  On Aug 4, 4:25 am, David Marko dma...@tiscali.cz wrote:

   How to define DAL query to retrieve items and theirs tags? I have
   following tables:

   'message'  -- 'tagging'(maty-to-many between message and tag tables)
   --- 'tag'

   How to retrieve list of all mesages and their assotiated tags so I can
   list messages in a view like this:
   1. message text 01  (tags: tag01, tag03)
   2. message text 02  (tags: tag03, tag05, tag06)
   etc.

   I looked to web2py book to 'One to Many Relation' examples but they
   returns items in a way that gives me result like this:
   1. message text 01 (tags: tag01)
   2. message text 01 (tags: tag03)
   3. message text 02 (tags: tag03)
   4. message text 02 (tags: tag05)
   5. message text 02 (tags: tag06)

   There must be something I missed.
   David


[web2py] Re: Custom dynamic form submission

2010-08-04 Thread mdipierro
I can send an example. Can you described the model and how input
fields should be mapped into db fields?

On Aug 4, 4:50 am, cogarg cog...@gmail.com wrote:
 Thanks for the reply, i will look into replacing the add/remove
 functions with that jquery code, but i('ll) still have the same
 issue;
 I can't figure out how to make a controller that will process the
 whole form and insert all the fields in a database.

 I'm trying to write a loop to manually insert each set of fields to
 the database if form.vars.fieldaN is not empty, but i still can't make
 it work...

 On Aug 3, 9:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  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] web2py classes

2010-08-04 Thread mdipierro
I am teaching two classes on web2py this fall:

   http://www.cdm.depaul.edu/ipd/Programs/Pages/WebDevelopmentwithPython.aspx
   (2 credit hours)

   
http://mycti.cti.depaul.edu/programs/courses.asp?section=coursescourseid=438deptmne=CSC
   (4 credit hours)

They are both available online.

The first of them is aimed to professionals and gives a certificate.

The description of the latter does not mention web2py but that is
because  we I did not go through the process of revising the
description and the course predates web2py. Yet as you can see from
the syllabus, the textbook is web2py's book:

   
http://mycti.cti.depaul.edu/courses/syllabus_mycti.asp?course=CSC-438-701q=1y=2009id=343

I have no control over the course fees since these are DePaul courses.

Massimo


[web2py] Re: Custom dynamic form submission

2010-08-04 Thread cogarg
For now, this is the db model:
db.define_table('ekped',
Field('userid'),  # From db.auth_user.id
Field('typ_ptyx'),
Field('idryma'),
Field('sxolh'),
Field('titlos'),
Field('polh_xwra'),
Field('etos'))

And the form-db field mapping should be like this(N is a number):
fieldaN - typ_ptyx
fieldbN - idryma
fieldcN - sxolh
fielddN - titlos
fieldeN - polh_xwra
fieldfN - etos

Thanks for all the help!

On Aug 4, 12:51 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I can send an example. Can you described the model and how input
 fields should be mapped into db fields?

 On Aug 4, 4:50 am, cogarg cog...@gmail.com wrote:

  Thanks for the reply, i will look into replacing the add/remove
  functions with that jquery code, but i('ll) still have the same
  issue;
  I can't figure out how to make a controller that will process the
  whole form and insert all the fields in a database.

  I'm trying to write a loop to manually insert each set of fields to
  the database if form.vars.fieldaN is not empty, but i still can't make
  it work...

  On Aug 3, 9:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   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: Custom dynamic form submission

2010-08-04 Thread mdipierro
How about this?

def callback():
mapping=[
 ('fielda%i','typ_ptyx'),
 ('fieldb%i','idryma'),
 ('fieldc%i','sxolh'),
 ('fieldd%i','titlos'),
 ('fielde%i','polh_xwra'),
 ('fieldf%i','etos')]
   for i in range(1,100):
  values = dict((field,request.vars[key%i]) for key, field in
mapping if request.vars.get(key%i,None))
  if not values: break
  db.ekped.insert(**values)

On Aug 4, 5:32 am, cogarg cog...@gmail.com wrote:
 For now, this is the db model:
 db.define_table('ekped',
     Field('userid'),          # From db.auth_user.id
     Field('typ_ptyx'),
     Field('idryma'),
     Field('sxolh'),
     Field('titlos'),
     Field('polh_xwra'),
     Field('etos'))

 And the form-db field mapping should be like this(N is a number):
 fieldaN - typ_ptyx
 fieldbN - idryma
 fieldcN - sxolh
 fielddN - titlos
 fieldeN - polh_xwra
 fieldfN - etos

 Thanks for all the help!

 On Aug 4, 12:51 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I can send an example. Can you described the model and how input
  fields should be mapped into db fields?

  On Aug 4, 4:50 am, cogarg cog...@gmail.com wrote:

   Thanks for the reply, i will look into replacing the add/remove
   functions with that jquery code, but i('ll) still have the same
   issue;
   I can't figure out how to make a controller that will process the
   whole form and insert all the fields in a database.

   I'm trying to write a loop to manually insert each set of fields to
   the database if form.vars.fieldaN is not empty, but i still can't make
   it work...

   On Aug 3, 9:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:

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.


Re: [web2py] Re: Web2py Application Exhibition -- Winners!

2010-08-04 Thread Mr admin
The number of participants was two.

Mr.NetAdmin


On Wed, Aug 4, 2010 at 2:49 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Can you post some stats?
 Number of participants for example.

 Massimo

 On Aug 3, 2:01 pm, NetAdmin mr.netad...@gmail.com wrote:
  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



[web2py] Re: Custom dynamic form submission

2010-08-04 Thread cogarg
This works fine, except for one thing; i also need to add the userid
to the database so i can associate the records in the database to a
registered user...i suspect it's a really easy fix, but i just can't
figure it out...

Thanks

On Aug 4, 1:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 How about this?

 def callback():
     mapping=[
      ('fielda%i','typ_ptyx'),
      ('fieldb%i','idryma'),
      ('fieldc%i','sxolh'),
      ('fieldd%i','titlos'),
      ('fielde%i','polh_xwra'),
      ('fieldf%i','etos')]
    for i in range(1,100):
       values = dict((field,request.vars[key%i]) for key, field in
 mapping if request.vars.get(key%i,None))
       if not values: break
       db.ekped.insert(**values)

 On Aug 4, 5:32 am, cogarg cog...@gmail.com wrote:

  For now, this is the db model:
  db.define_table('ekped',
      Field('userid'),          # From db.auth_user.id
      Field('typ_ptyx'),
      Field('idryma'),
      Field('sxolh'),
      Field('titlos'),
      Field('polh_xwra'),
      Field('etos'))

  And the form-db field mapping should be like this(N is a number):
  fieldaN - typ_ptyx
  fieldbN - idryma
  fieldcN - sxolh
  fielddN - titlos
  fieldeN - polh_xwra
  fieldfN - etos

  Thanks for all the help!

  On Aug 4, 12:51 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I can send an example. Can you described the model and how input
   fields should be mapped into db fields?

   On Aug 4, 4:50 am, cogarg cog...@gmail.com wrote:

Thanks for the reply, i will look into replacing the add/remove
functions with that jquery code, but i('ll) still have the same
issue;
I can't figure out how to make a controller that will process the
whole form and insert all the fields in a database.

I'm trying to write a loop to manually insert each set of fields to
the database if form.vars.fieldaN is not empty, but i still can't make
it work...

On Aug 3, 9:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:

 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] form submit to populate a div, ajax style

2010-08-04 Thread Andrew Buchan
Hi, how do I make the 'accepts' function of a form update some other
part of a form? I can do it with a specific button, but want the
validation provided by the 'accepts' function too

In View:

br/br/
{{=searchForm}}
br/br/
{{=DIV(_id='searchResults')}

In controller:

if searchForm.accepts(request.vars, formname='search'):
   ajax('performSearch', ['raisedBefore'], 'searchResults') #
doesn't work because ajax is not defined...


Re: [web2py] Re: plugin_wiki suggestions

2010-08-04 Thread Bruno Rocha
Sorry, I am so stupid... I forgotten about anchors

Thanks again

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

 Yes you can:

 [[my reference #id1]]

 [[id1]] referenced material

 On Aug 3, 11:56 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  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




-- 

http://rochacbruno.com.br


[web2py] Re: Custom dynamic form submission

2010-08-04 Thread mdipierro
def callback():
mapping=[
 ('fielda%i','typ_ptyx'),
 ('fieldb%i','idryma'),
 ('fieldc%i','sxolh'),
 ('fieldd%i','titlos'),
 ('fielde%i','polh_xwra'),
 ('fieldf%i','etos')]
   for i in range(1,100):
  values = dict((field,request.vars[key%i]) for key, field in
mapping if request.vars.get(key%i,None))
  if not values: break
  values[userid]=auth.user_id # 
  db.ekped.insert(**values)

On Aug 4, 6:38 am, cogarg cog...@gmail.com wrote:
 This works fine, except for one thing; i also need to add the userid
 to the database so i can associate the records in the database to a
 registered user...i suspect it's a really easy fix, but i just can't
 figure it out...

 Thanks

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

  How about this?

  def callback():
      mapping=[
       ('fielda%i','typ_ptyx'),
       ('fieldb%i','idryma'),
       ('fieldc%i','sxolh'),
       ('fieldd%i','titlos'),
       ('fielde%i','polh_xwra'),
       ('fieldf%i','etos')]
     for i in range(1,100):
        values = dict((field,request.vars[key%i]) for key, field in
  mapping if request.vars.get(key%i,None))
        if not values: break
        db.ekped.insert(**values)

  On Aug 4, 5:32 am, cogarg cog...@gmail.com wrote:

   For now, this is the db model:
   db.define_table('ekped',
       Field('userid'),          # From db.auth_user.id
       Field('typ_ptyx'),
       Field('idryma'),
       Field('sxolh'),
       Field('titlos'),
       Field('polh_xwra'),
       Field('etos'))

   And the form-db field mapping should be like this(N is a number):
   fieldaN - typ_ptyx
   fieldbN - idryma
   fieldcN - sxolh
   fielddN - titlos
   fieldeN - polh_xwra
   fieldfN - etos

   Thanks for all the help!

   On Aug 4, 12:51 pm, mdipierro mdipie...@cs.depaul.edu wrote:

I can send an example. Can you described the model and how input
fields should be mapped into db fields?

On Aug 4, 4:50 am, cogarg cog...@gmail.com wrote:

 Thanks for the reply, i will look into replacing the add/remove
 functions with that jquery code, but i('ll) still have the same
 issue;
 I can't figure out how to make a controller that will process the
 whole form and insert all the fields in a database.

 I'm trying to write a loop to manually insert each set of fields to
 the database if form.vars.fieldaN is not empty, but i still can't make
 it work...

 On Aug 3, 9:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  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: Web2py Application Exhibition -- Winners!

2010-08-04 Thread mdipierro
Next time we need a money prize. ;-)

On Aug 4, 6:22 am, Mr admin mr.netad...@gmail.com wrote:
 The number of participants was two.

 Mr.NetAdmin

 On Wed, Aug 4, 2010 at 2:49 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  Can you post some stats?
  Number of participants for example.

  Massimo

  On Aug 3, 2:01 pm, NetAdmin mr.netad...@gmail.com wrote:
   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


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

2010-08-04 Thread Iceberg
Yes but that only works in the earlier welcome scaffold shipped with
web2py 1.79.x or so.

The latest web2py's welcome uses SuperFish menu (
http://users.tpg.com.au/j_birch/plugins/superfish/ ), which is
supposed to be capable for that too, but in fact the out-of-box
welcome/static/base.css losts a necessary definition:
.web2py-menu-active a {
background-color: white;
}

Besides, the latest welcome/static/base.css also
losts .warn, .info, .error, they are supposed to be used in the
scenario such as:
response.flash = DIV('everything is good', _class='info')
response.flash = DIV('sth is wrong but I can hang on',
_class='warn')
response.flash = DIV('fatal error', _class='error')

The point here, is that what features in base.css are supposed to be
maintained, and what else are subjected to change without notice?

Regards,
Iceberg

On Aug 4, 3:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 The ul.../ul code in Django in web2py translates with

 {{=MENU(response.menu)}}

 where (using the data in your example)

 response.menu=[
   ('Home',request.function=='home',URL(r=request,f='home'),[]),
   ('Store Information',request.function=='info',URL(r=request,f=info'),
 []),
 ]

 The latter code can go in menu.py but you can place it in any mode.
 MENU(...) takes arguments that allows you to customize the class of
 the ul amd li. It also handles submenu (the [] above are
 submenus).

 On Aug 3, 4:38 pm, mwolfe02 michael.joseph.wo...@gmail.com wrote:



  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


Re: [web2py] Re: Web2py Application Exhibition -- Winners!

2010-08-04 Thread Mr admin
The first place prize was $100 dollars, 2nd place was $50



On Wed, Aug 4, 2010 at 8:13 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Next time we need a money prize. ;-)

 On Aug 4, 6:22 am, Mr admin mr.netad...@gmail.com wrote:
  The number of participants was two.
 
  Mr.NetAdmin
 
  On Wed, Aug 4, 2010 at 2:49 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   Can you post some stats?
   Number of participants for example.
 
   Massimo
 
   On Aug 3, 2:01 pm, NetAdmin mr.netad...@gmail.com wrote:
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



[web2py] Re: Custom dynamic form submission

2010-08-04 Thread cogarg
There was a little problem with the code, but, for once, i managed to
solve it on my own!

userid had to be 'userid'

   values['userid']=auth.user_id

Thanks for all the help!

On Aug 4, 4:12 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 def callback():
     mapping=[
      ('fielda%i','typ_ptyx'),
      ('fieldb%i','idryma'),
      ('fieldc%i','sxolh'),
      ('fieldd%i','titlos'),
      ('fielde%i','polh_xwra'),
      ('fieldf%i','etos')]
    for i in range(1,100):
       values = dict((field,request.vars[key%i]) for key, field in
 mapping if request.vars.get(key%i,None))
       if not values: break
       values[userid]=auth.user_id # 
       db.ekped.insert(**values)

 On Aug 4, 6:38 am, cogarg cog...@gmail.com wrote:

  This works fine, except for one thing; i also need to add the userid
  to the database so i can associate the records in the database to a
  registered user...i suspect it's a really easy fix, but i just can't
  figure it out...

  Thanks

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

   How about this?

   def callback():
       mapping=[
        ('fielda%i','typ_ptyx'),
        ('fieldb%i','idryma'),
        ('fieldc%i','sxolh'),
        ('fieldd%i','titlos'),
        ('fielde%i','polh_xwra'),
        ('fieldf%i','etos')]
      for i in range(1,100):
         values = dict((field,request.vars[key%i]) for key, field in
   mapping if request.vars.get(key%i,None))
         if not values: break
         db.ekped.insert(**values)

   On Aug 4, 5:32 am, cogarg cog...@gmail.com wrote:

For now, this is the db model:
db.define_table('ekped',
    Field('userid'),          # From db.auth_user.id
    Field('typ_ptyx'),
    Field('idryma'),
    Field('sxolh'),
    Field('titlos'),
    Field('polh_xwra'),
    Field('etos'))

And the form-db field mapping should be like this(N is a number):
fieldaN - typ_ptyx
fieldbN - idryma
fieldcN - sxolh
fielddN - titlos
fieldeN - polh_xwra
fieldfN - etos

Thanks for all the help!

On Aug 4, 12:51 pm, mdipierro mdipie...@cs.depaul.edu wrote:

 I can send an example. Can you described the model and how input
 fields should be mapped into db fields?

 On Aug 4, 4:50 am, cogarg cog...@gmail.com wrote:

  Thanks for the reply, i will look into replacing the add/remove
  functions with that jquery code, but i('ll) still have the same
  issue;
  I can't figure out how to make a controller that will process the
  whole form and insert all the fields in a database.

  I'm trying to write a loop to manually insert each set of fields to
  the database if form.vars.fieldaN is not empty, but i still can't 
  make
  it work...

  On Aug 3, 9:49 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   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: this must be asked a 1000 times, but I couldn't find the answer

2010-08-04 Thread Michael Ellis
As my application's views have become more complex, I've also been
considering the same questions concerning Python vs HTML coding.  I've
tried using the helpers but my brain finds the stacks of parentheses
even more confusing than HTML closing tags.  Currently, I'm defining
functions in my views that encapsulate frequently used blocks of HTML
in triple-quoted strings.  I use standard python dictionary
substitution, %(name)s to inject parameters.  Here's a relatively
simple  example.

def responseslider(inp,inpid,label):
inpval = inp['_value']
html = 
 li class=respond.slider
table class=respond
tr
td class=inset/td
td
div class=slider_wrapper
%(inp)s
div id=slider_%(inpid)s /div
span id=slider_%(inpid)s_val%
(inpval)s/span
/div
/td
td%(label)s/td
/tr
/table
/li
%locals()
return XML(html)

This seems, for my application at least, to be the best approach I've
found so far.

One thing that's occurred to me is how nice it would be if we could
use python-style indentation instead of closing tags when writing HTML
in views.  So in the example above,  suppose the HTML could be
simplified to:

 li class=respond.slider
table class=respond
tr
td class=inset
td
div class=slider_wrapper
%(inp)s
div id=slider_%(inpid)s 
span id=slider_%(inpid)s_val%
(inpval)s
td%(label)s

The indentation rules would be similar to Python's.  Any opening tag
would behave like colon-terminated python conditional; the parser
would defer generating a closing tag until the indentation level
returned to the original level.  I believe there would be no ambiguity
as long as the indentation is correct, but perhaps there's a case I
haven't thought of.  I searched to see if someone has done something
like this before but so far haven't found anything.

I think it's worth noting that when HTML came into being in the late
80's the universe of digital documents contained a lot of text files
that just needed a little markup to render them more attractively --
so a language with closing tags made sense because the ratio of markup
to text was very low and transmission bandwidth was limited.  Nowadays
the situation is largely the opposite. Most web pages are mostly
markup because users have come to expect very high-quality
presentation.  The markup to text ratio in a typical page from the
online web2py book -- surely a text-heavy document as web pages go --
is more than 5 to 1.

It's clear that, as web authors, we need all the help we can get.

Cheers,
Mike

On Aug 4, 5:16 am, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 Current way is good enough , it gives programmers choices.
 Many of us want to code in HTML as Long as they are static
 .
 May be pure python templating system which can be enable from response.view



 On Wed, Aug 4, 2010 at 3:40 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  This is a good point.

  to do it with the current web2py the code at best would look like
  this:

  Stef Mientki
  View profile   Translate to Translated (View Original)
          More options Aug 4, 3:39 am
  From: Stef Mientki stef.mien...@gmail.com
  Date: Wed, 04 Aug 2010 10:39:48 +0200
  Local: Wed, Aug 4 2010 3:39 am
  Subject: this must be asked a 1000 times, but I couldn't find the
  answer
  Reply | Reply to author | Forward | Print | Individual message | Show
  original | Remove | Report this message | Find messages by this author
   please forgive my ignorance,
  but I wonder why views are not written in Python, instead of html
  ( see comparison below of te first
  part of default\index.html.

  The advantage of using Python:
  - the user can stick to 1 language
  - no redundant information in the closing tags, like ul , /ul
  - most editors checks the closing brackets
  - normal indentation, no problems with missing pass
  The disavantages of using Python:
  - ???

  thanks,
  Stef Mientki

  {{extend  'layout.html' }}
  {{
  if 'message' in globals () :
   =H2 ( message )
  else:
    =BEAUTIFY ( response._vars )
  pass

  = HR ()
  = H1 ( 'README' )
  = UL (
   LI ( T ( 'You are successfully running web2py' ) ),
   LI ( T ( 'This is a copy of the scaffolding application' ) ),
   LI ( T ( 'You can modify this application and adapt it to your
  needs' ) ),
   LI ( T ( A ( B ( T ( click here for the administrative
  interface)),
                __href = URL ( 'admin', 'default', 'index' ) ) )) ),
    LI ( A ( T ( click here for online examples),
             _href = URL ( 'examples', 'default', 'index' ) ) ),
   '...')
  }}

  I.e.
  - 

[web2py] Web2py Application Exhibition -- The Winners!

2010-08-04 Thread NetAdmin
Hello Web2py Users!

After careful consideration of the entire list of entries...
( actually the only entry )
the winning entry was submitted by Martin Mulone of Entre Rios,
Argentina.
Martin enjoys music, programming in python, soccer and sailing.

His entry, Instant-Press, which is a blogging application, can be
found at
http://code.google.com/p/instant-press/

Martin takes home the 1st place prize of $100 dollars.

Since there were no entries for second place, I chose give Thadeus
Burgess
the second-place award of $50 dollars.

Why Thadeus? During the submission period, his offer to help judge
the competition entries, best exemplified the spirit of open-source.

Thadeus Burgess is from Austin, Texas and his interests include
Starcraft,
paintballing, AI and robotics, and hanging out with friends and
family.

Thadeus is also a contributor to the Web2py book.

Thadeus has websites at http://thadeusb.com/ and
http://odyssey.ecrater.com/filter.php?sort=date

Congratulations to both of them!

Rumor has it, that there will be another Exhibition in November 2010

Stay tuned for details!

Mr.NetAdmin


Re: [web2py] Re: this must be asked a 1000 times, but I couldn't find the answer

2010-08-04 Thread Stef Mientki
 Interesting approach !
Should be a good intermediate step, ...
... what I was thinking of (don't know yet if it's possible at all ;-)
... is a wysiwyg html editor combined with a syntax highlighter (for the 
embedded Python code)

here is a first attempt, I'm making for totally other project,



the code syntax is not highlighted yet, but you can embed nicely indented 
Python code.
The idea is to reserve a range of tags to indicate code.
In the example above, the Python code is extended with a lot of global 
functions (like in web2py ;-)
and the Python language is made case insensitive, that all for non-programmers 
to make programs.

cheers,
Stef Mientki

On 04-08-2010 15:39, Michael Ellis wrote:
 As my application's views have become more complex, I've also been
 considering the same questions concerning Python vs HTML coding.  I've
 tried using the helpers but my brain finds the stacks of parentheses
 even more confusing than HTML closing tags.  Currently, I'm defining
 functions in my views that encapsulate frequently used blocks of HTML
 in triple-quoted strings.  I use standard python dictionary
 substitution, %(name)s to inject parameters.  Here's a relatively
 simple  example.

 def responseslider(inp,inpid,label):
 inpval = inp['_value']
 html = 
  li class=respond.slider
 table class=respond
 tr
 td class=inset/td
 td
 div class=slider_wrapper
 %(inp)s
 div id=slider_%(inpid)s /div
 span id=slider_%(inpid)s_val%
 (inpval)s/span
 /div
 /td
 td%(label)s/td
 /tr
 /table
 /li
 %locals()
 return XML(html)

 This seems, for my application at least, to be the best approach I've
 found so far.

 One thing that's occurred to me is how nice it would be if we could
 use python-style indentation instead of closing tags when writing HTML
 in views.  So in the example above,  suppose the HTML could be
 simplified to:

  li class=respond.slider
 table class=respond
 tr
 td class=inset
 td
 div class=slider_wrapper
 %(inp)s
 div id=slider_%(inpid)s 
 span id=slider_%(inpid)s_val%
 (inpval)s
 td%(label)s

 The indentation rules would be similar to Python's.  Any opening tag
 would behave like colon-terminated python conditional; the parser
 would defer generating a closing tag until the indentation level
 returned to the original level.  I believe there would be no ambiguity
 as long as the indentation is correct, but perhaps there's a case I
 haven't thought of.  I searched to see if someone has done something
 like this before but so far haven't found anything.

 I think it's worth noting that when HTML came into being in the late
 80's the universe of digital documents contained a lot of text files
 that just needed a little markup to render them more attractively --
 so a language with closing tags made sense because the ratio of markup
 to text was very low and transmission bandwidth was limited.  Nowadays
 the situation is largely the opposite. Most web pages are mostly
 markup because users have come to expect very high-quality
 presentation.  The markup to text ratio in a typical page from the
 online web2py book -- surely a text-heavy document as web pages go --
 is more than 5 to 1.

 It's clear that, as web authors, we need all the help we can get.

 Cheers,
 Mike

 On Aug 4, 5:16 am, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 Current way is good enough , it gives programmers choices.
 Many of us want to code in HTML as Long as they are static
 .
 May be pure python templating system which can be enable from response.view



 On Wed, Aug 4, 2010 at 3:40 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 This is a good point.
 to do it with the current web2py the code at best would look like
 this:
 Stef Mientki
 View profile   Translate to Translated (View Original)
 More options Aug 4, 3:39 am
 From: Stef Mientki stef.mien...@gmail.com
 Date: Wed, 04 Aug 2010 10:39:48 +0200
 Local: Wed, Aug 4 2010 3:39 am
 Subject: this must be asked a 1000 times, but I couldn't find the
 answer
 Reply | Reply to author | Forward | Print | Individual message | Show
 original | Remove | Report this message | Find messages by this author
  please forgive my ignorance,
 but I wonder why views are not written in Python, instead of html
 ( see comparison below of te first
 part of default\index.html.
 The advantage of using Python:
 - the user can stick to 1 language
 - no redundant information in the closing tags, like ul , /ul
 - most editors checks the closing brackets
 - normal indentation, no 

[web2py] web2py/facebook example appliance

2010-08-04 Thread mcm
I updated info at the following url:

http://wiki.developers.facebook.com/index.php/User:Python#web2py



Re: [web2py] Re: Web2py Application Exhibition -- Winners!

2010-08-04 Thread Michele Comitini
Seems like participants play only if they win!!! ;-)


2010/8/4 Mr admin mr.netad...@gmail.com:
 The first place prize was $100 dollars, 2nd place was $50



 On Wed, Aug 4, 2010 at 8:13 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Next time we need a money prize. ;-)

 On Aug 4, 6:22 am, Mr admin mr.netad...@gmail.com wrote:
  The number of participants was two.
 
  Mr.NetAdmin
 
  On Wed, Aug 4, 2010 at 2:49 AM, mdipierro mdipie...@cs.depaul.edu
  wrote:
   Can you post some stats?
   Number of participants for example.
 
   Massimo
 
   On Aug 3, 2:01 pm, NetAdmin mr.netad...@gmail.com wrote:
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



[web2py] Re: uft 8

2010-08-04 Thread sarsar
I hope that you have checked the language settings of your browser and
you have used the admin part for updating languages, before
translating the field . I hope it helps

Sarados

On 3 Αύγ, 14:35, max dulip.withan...@gmail.com wrote:
 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: Web2py Application Exhibition -- The Winners!

2010-08-04 Thread GoldenTiger
Great application InstantPress!
What is the website of this competition?
I did not know about it

On 4 ago, 15:55, NetAdmin mr.netad...@gmail.com wrote:
 Hello Web2py Users!

 After careful consideration of the entire list of entries...
 ( actually the only entry )
 the winning entry was submitted by Martin Mulone of Entre Rios,
 Argentina.
 Martin enjoys music, programming in python, soccer and sailing.

 His entry, Instant-Press, which is a blogging application, can be
 found athttp://code.google.com/p/instant-press/

 Martin takes home the 1st place prize of $100 dollars.

 Since there were no entries for second place, I chose give Thadeus
 Burgess
 the second-place award of $50 dollars.

 Why Thadeus? During the submission period, his offer to help judge
 the competition entries, best exemplified the spirit of open-source.

 Thadeus Burgess is from Austin, Texas and his interests include
 Starcraft,
 paintballing, AI and robotics, and hanging out with friends and
 family.

 Thadeus is also a contributor to the Web2py book.

 Thadeus has websites 
 athttp://thadeusb.com/andhttp://odyssey.ecrater.com/filter.php?sort=date

 Congratulations to both of them!

 Rumor has it, that there will be another Exhibition in November 2010

 Stay tuned for details!

 Mr.NetAdmin


[web2py] Re: Web2py Application Exhibition -- The Winners!

2010-08-04 Thread NetAdmin

I did all of the promotion through messages on this group.
( Search for the word Exhibition )

Mr.NetAdmin


On Aug 4, 11:44 am, GoldenTiger goldenboy...@gmail.com wrote:
 Great application InstantPress!
 What is the website of this competition?
 I did not know about it

 On 4 ago, 15:55, NetAdmin mr.netad...@gmail.com wrote:

  Hello Web2py Users!

  After careful consideration of the entire list of entries...
  ( actually the only entry )
  the winning entry was submitted by Martin Mulone of Entre Rios,
  Argentina.
  Martin enjoys music, programming in python, soccer and sailing.

  His entry, Instant-Press, which is a blogging application, can be
  found athttp://code.google.com/p/instant-press/

  Martin takes home the 1st place prize of $100 dollars.

  Since there were no entries for second place, I chose give Thadeus
  Burgess
  the second-place award of $50 dollars.

  Why Thadeus? During the submission period, his offer to help judge
  the competition entries, best exemplified the spirit of open-source.

  Thadeus Burgess is from Austin, Texas and his interests include
  Starcraft,
  paintballing, AI and robotics, and hanging out with friends and
  family.

  Thadeus is also a contributor to the Web2py book.

  Thadeus has websites 
  athttp://thadeusb.com/andhttp://odyssey.ecrater.com/filter.php?sort=date

  Congratulations to both of them!

  Rumor has it, that there will be another Exhibition in November 2010

  Stay tuned for details!

  Mr.NetAdmin


[web2py] Re: Web2py Application Exhibition -- Winners!

2010-08-04 Thread mikech
That is a good looking app!

On Aug 3, 12:01 pm, NetAdmin mr.netad...@gmail.com wrote:
 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


[web2py] Re: Web2py Application Exhibition -- The Winners!

2010-08-04 Thread Wobmofo
Congrats to InstantPress, it's really great.
Too bad few were aware of this competition. Next time, it would be
great if it was stickied in the group.

On Aug 4, 6:52 pm, NetAdmin mr.netad...@gmail.com wrote:
 I did all of the promotion through messages on this group.
 ( Search for the word Exhibition )

 Mr.NetAdmin

 On Aug 4, 11:44 am, GoldenTiger goldenboy...@gmail.com wrote:

  Great application InstantPress!
  What is the website of this competition?
  I did not know about it

  On 4 ago, 15:55, NetAdmin mr.netad...@gmail.com wrote:

   Hello Web2py Users!

   After careful consideration of the entire list of entries...
   ( actually the only entry )
   the winning entry was submitted by Martin Mulone of Entre Rios,
   Argentina.
   Martin enjoys music, programming in python, soccer and sailing.

   His entry, Instant-Press, which is a blogging application, can be
   found athttp://code.google.com/p/instant-press/

   Martin takes home the 1st place prize of $100 dollars.

   Since there were no entries for second place, I chose give Thadeus
   Burgess
   the second-place award of $50 dollars.

   Why Thadeus? During the submission period, his offer to help judge
   the competition entries, best exemplified the spirit of open-source.

   Thadeus Burgess is from Austin, Texas and his interests include
   Starcraft,
   paintballing, AI and robotics, and hanging out with friends and
   family.

   Thadeus is also a contributor to the Web2py book.

   Thadeus has websites 
   athttp://thadeusb.com/andhttp://odyssey.ecrater.com/filter.php?sort=date

   Congratulations to both of them!

   Rumor has it, that there will be another Exhibition in November 2010

   Stay tuned for details!

   Mr.NetAdmin




[web2py] Re: Web2py Application Exhibition -- The Winners!

2010-08-04 Thread mdipierro
Mr Admin did a good job at advertising on the list. Perhpas I should
have helped him more with twitter etc. Well. Next time.

I want to point out that Mr Admin is using his own money to pay for
the prizes so we all owe him a big thank you.

We got InstantPress out of it and that is fantastic.

Massimo

On Aug 4, 2:00 pm, Wobmofo muito...@gmail.com wrote:
 Congrats to InstantPress, it's really great.
 Too bad few were aware of this competition. Next time, it would be
 great if it was stickied in the group.

 On Aug 4, 6:52 pm, NetAdmin mr.netad...@gmail.com wrote:

  I did all of the promotion through messages on this group.
  ( Search for the word Exhibition )

  Mr.NetAdmin

  On Aug 4, 11:44 am, GoldenTiger goldenboy...@gmail.com wrote:

   Great application InstantPress!
   What is the website of this competition?
   I did not know about it

   On 4 ago, 15:55, NetAdmin mr.netad...@gmail.com wrote:

Hello Web2py Users!

After careful consideration of the entire list of entries...
( actually the only entry )
the winning entry was submitted by Martin Mulone of Entre Rios,
Argentina.
Martin enjoys music, programming in python, soccer and sailing.

His entry, Instant-Press, which is a blogging application, can be
found athttp://code.google.com/p/instant-press/

Martin takes home the 1st place prize of $100 dollars.

Since there were no entries for second place, I chose give Thadeus
Burgess
the second-place award of $50 dollars.

Why Thadeus? During the submission period, his offer to help judge
the competition entries, best exemplified the spirit of open-source.

Thadeus Burgess is from Austin, Texas and his interests include
Starcraft,
paintballing, AI and robotics, and hanging out with friends and
family.

Thadeus is also a contributor to the Web2py book.

Thadeus has websites 
athttp://thadeusb.com/andhttp://odyssey.ecrater.com/filter.php?sort=date

Congratulations to both of them!

Rumor has it, that there will be another Exhibition in November 2010

Stay tuned for details!

Mr.NetAdmin


[web2py] Re: this must be asked a 1000 times, but I couldn't find the answer

2010-08-04 Thread Andy Pardue
Everyone at some point has this thought. But there is a big down side
to generating all the html in code, it makes the application hard to
skin. I can skin a web2py application in half and hour not including
cleaning up the menus with any template I come across. I do like
generate the html I am grabbing from the data most the time. Nice to
have both methods available.

On Aug 4, 1:39 am, Stef Mientki stef.mien...@gmail.com wrote:
  please forgive my ignorance,
 but I wonder why views are not written in Python, instead of html ( see 
 comparison below of te first
 part of default\index.html.

 The advantage of using Python:
 - the user can stick to 1 language
 - no redundant information in the closing tags, like ul , /ul
 - most editors checks the closing brackets
 - normal indentation, no problems with missing pass
 The disavantages of using Python:
 - ???

 thanks,
 Stef Mientki

 # ***
 extend ( 'layout.html' )

 if 'message' in globals () :
   H2 ( message )
 else:
   DISPLAY ( BEAUTIFY ( response._vars ) )

 HR ()
 H1 ( 'README' )
 UL (
   LI ( T ( 'You are successfully running web2py' ) ),
   LI ( T ( 'This is a copy of the scaffolding application' ) ),
   LI ( T ( 'You can modify this application and adapt it to your needs' ) ),
   LI ( T ( A ( B ( T ( click here for the administrative interface)),
               _HREF ( URL ( 'admin', 'default', 'index' ) ) ) ) ),
   LI ( A ( T ( click here for online examples),
            _HREF ( URL ( 'examples', 'default', 'index' ) ) ) ),
   LI ( HREF ( http://web2py.com;, 'web2py.com' ) ),
   LI ( HREF ( http://web2py.com/book;, T ( 'documentation' ) ) ) )

 # ***
 {{extend 'layout.html'}}

 {{if 'message' in 
 globals():}}{{=H2(message)}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}

 hr /
 h1README/h1
 ul
   li{{=T('You are successfully running web2py')}}/li
   li{{=T('This is a copy of the scaffolding application')}}/li
   li{{=T('You can modify this application and adapt it to your 
 needs')}}/li
   li{{=A(B(T(click here for the administrative interface)),
 _href=URL('admin','default','index'))}}/li
   li{{=A(T(click here for online examples), 
 _href=URL('examples','default','index'))}}/li
   lia href=http://web2py.com;web2py.com/a/li
   lia href=http://web2py.com/book;{{=T('documentation')}}/a/li
 /ul


[web2py] recaptcha settings RCS update

2010-08-04 Thread Vidul Petrov
Hi Massimo,

I sent you an email with a Mercurial diff about retrieve_(username/
password) settings and captcha:

diff -r 3e0d95c0a0d5 gluon/tools.py
--- a/gluon/tools.pySun Aug 01 04:53:46 2010 -0500
+++ b/gluon/tools.pySun Aug 01 18:38:00 2010 +0300
@@ -804,6 +804,8 @@
 self.settings.mailer = None
 self.settings.login_captcha = None
 self.settings.register_captcha = None
+self.settings.retrieve_username_captcha = None
+self.settings.retrieve_password_captcha = None
 self.settings.captcha = None
 self.settings.expiration = 3600 # one day
 self.settings.long_expiration = 3600*30 # one month
@@ -1677,7 +1679,8 @@
 request = self.environment.request
 response = self.environment.response
 session = self.environment.session
-
+captcha = self.settings.retrieve_username_captcha or \
+(self.settings.retrieve_username_captcha!=False and
self.settings.captcha)
 if not self.settings.mailer:
 response.flash = self.messages.function_disabled
 return ''
@@ -1702,6 +1705,10 @@
delete_label=self.messages.delete_label,
formstyle=self.settings.formstyle
)
+if captcha:
+form[0].insert(-1, TR(LABEL(captcha.label),
+  captcha,captcha.comment,
+  _id = 'capctha__row'))
 if form.accepts(request.post_vars, session,
 formname='retrieve_username', dbio=False,
 
onvalidation=onvalidation,hideerror=self.settings.hideerror):
@@ -1894,6 +1901,8 @@
 request = self.environment.request
 response = self.environment.response
 session = self.environment.session
+captcha = self.settings.retrieve_password_captcha or \
+(self.settings.retrieve_password_captcha!=False and
self.settings.captcha)

 if next == DEFAULT:
 next = request.get_vars._next \
@@ -1920,6 +1929,10 @@
delete_label=self.messages.delete_label,
formstyle=self.settings.formstyle
)
+if captcha:
+form[0].insert(-1, TR(LABEL(captcha.label),
+  captcha,captcha.comment,
+  _id = 'capctha__row'))
 if form.accepts(request.post_vars, session,
 formname='reset_password', dbio=False,
 
onvalidation=onvalidation,hideerror=self.settings.hideerror):

My question is - should I hope to see this in trunk or not?

I am happy to see so many updates each day, but I am unhappy to see
that there is not one single web2py version (in other words stable)
that has no bugs (not to mention fully documented).


[web2py] maybe of interest for someone: Fwd: [ANN] Websourcebrowser 0.4a released

2010-08-04 Thread Stef Mientki


 Original Message 
Subject:[ANN] Websourcebrowser 0.4a released
Date:   Wed, 04 Aug 2010 22:41:42 +0200
From:   Stefan Schwarzer sschwar...@sschwarzer.net
Reply-To:   python-l...@python.org
Organization:   11 Internet AG
To: comp-lang-python-annou...@moderators.isc.org
Newsgroups: comp.lang.python,comp.lang.python.announce



Hello,

I'm happy to announce the release of Websourcebrowser 0.4a.

Websourcebrowser is a program intended to get a quick overview of a
project's source code. The program is controlled from a web browser
which displays a directory tree and a source code file side by side.

The homepage of the project is at

http://websourcebrowser.sschwarzer.net/

The download of version 0.4a is at

http://websourcebrowser.sschwarzer.net/download

*** Note that this is still an alpha release. ***

I use the program regularly to dive into new projects, but I consider
it in the alpha stage because it has been used and tested by only a
few other people than me.

On Windows, this version doesn't seem to work with IE 8.0 whereas
it works with Firefox 3.6.8.

I know the software could be improved a lot. For some ideas, look at

http://websourcebrowser.sschwarzer.net/trac/wiki/Ideas
http://websourcebrowser.sschwarzer.net/trac/browser/todo.txt

If I implement this alone, it'll probably take years, given that
Websourcebrowser is a spare time project (beside my other project,
ftputil). So it would be great to get more developers on board.

Of course, I'm thankful for feedback on the mailing list (subscription
required to avoid spam, sorry),

http://codespeak.net/mailman/listinfo/websourcebrowser

or via private e-mail. If you encounter problems, you may also file a
bug report at

http://websourcebrowser.sschwarzer.net/trac/newticket

*** You need to log in as user wsbuser with password wsb . ***

Stefan

-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/



[web2py] routes.py in applications or how to access request in routes.py

2010-08-04 Thread Lasiaf
Hi,

I'm new to web2py and python.
Here is what I wanna accomplish:
I want to have routes.py in each application, so I can make separate
applications with different set of routes, because I will be hosting
it in a shared hosting and they have limited inodes of 50,000. So I
just want to keep a copy of 1 web2py folder and have multiple
applications inside.
so if I have routes.py in applications that means I could just add
different routes there. But I don't think thats a built in method.

Another I could access request.env.http_host and set different routes
from routes.py, if this is an ok method, how do I access request
object?
Also another thing is maybe I could set something in my dispatch.fcgi
to use different file than routes.py, if so how do I do it? then i'll
just have to mess around with my .htaccess

Thanks


[web2py] Re: recaptcha settings RCS update

2010-08-04 Thread mdipierro
Sorry I forgot. It is in trunk now. Please check it. Now I have to
revise the book once more. :-(

On Aug 4, 3:55 pm, Vidul Petrov vidul.r...@gmail.com wrote:
 Hi Massimo,

 I sent you an email with a Mercurial diff about retrieve_(username/
 password) settings and captcha:

 diff -r 3e0d95c0a0d5 gluon/tools.py
 --- a/gluon/tools.py    Sun Aug 01 04:53:46 2010 -0500
 +++ b/gluon/tools.py    Sun Aug 01 18:38:00 2010 +0300
 @@ -804,6 +804,8 @@
          self.settings.mailer = None
          self.settings.login_captcha = None
          self.settings.register_captcha = None
 +        self.settings.retrieve_username_captcha = None
 +        self.settings.retrieve_password_captcha = None
          self.settings.captcha = None
          self.settings.expiration = 3600         # one day
          self.settings.long_expiration = 3600*30 # one month
 @@ -1677,7 +1679,8 @@
          request = self.environment.request
          response = self.environment.response
          session = self.environment.session
 -
 +        captcha = self.settings.retrieve_username_captcha or \
 +                (self.settings.retrieve_username_captcha!=False and
 self.settings.captcha)
          if not self.settings.mailer:
              response.flash = self.messages.function_disabled
              return ''
 @@ -1702,6 +1705,10 @@
                         delete_label=self.messages.delete_label,
                         formstyle=self.settings.formstyle
                         )
 +        if captcha:
 +            form[0].insert(-1, TR(LABEL(captcha.label),
 +                                      captcha,captcha.comment,
 +                                      _id = 'capctha__row'))
          if form.accepts(request.post_vars, session,
                          formname='retrieve_username', dbio=False,

 onvalidation=onvalidation,hideerror=self.settings.hideerror):
 @@ -1894,6 +1901,8 @@
          request = self.environment.request
          response = self.environment.response
          session = self.environment.session
 +        captcha = self.settings.retrieve_password_captcha or \
 +                (self.settings.retrieve_password_captcha!=False and
 self.settings.captcha)

          if next == DEFAULT:
              next = request.get_vars._next \
 @@ -1920,6 +1929,10 @@
                         delete_label=self.messages.delete_label,
                         formstyle=self.settings.formstyle
                         )
 +        if captcha:
 +            form[0].insert(-1, TR(LABEL(captcha.label),
 +                                      captcha,captcha.comment,
 +                                      _id = 'capctha__row'))
          if form.accepts(request.post_vars, session,
                          formname='reset_password', dbio=False,

 onvalidation=onvalidation,hideerror=self.settings.hideerror):

 My question is - should I hope to see this in trunk or not?

 I am happy to see so many updates each day, but I am unhappy to see
 that there is not one single web2py version (in other words stable)
 that has no bugs (not to mention fully documented).


[web2py] Re: routes.py in applications or how to access request in routes.py

2010-08-04 Thread mdipierro
this is on our todo list

On Aug 4, 4:19 pm, Lasiaf fai...@altlimit.com wrote:
 Hi,

 I'm new to web2py and python.
 Here is what I wanna accomplish:
 I want to have routes.py in each application, so I can make separate
 applications with different set of routes, because I will be hosting
 it in a shared hosting and they have limited inodes of 50,000. So I
 just want to keep a copy of 1 web2py folder and have multiple
 applications inside.
 so if I have routes.py in applications that means I could just add
 different routes there. But I don't think thats a built in method.

 Another I could access request.env.http_host and set different routes
 from routes.py, if this is an ok method, how do I access request
 object?
 Also another thing is maybe I could set something in my dispatch.fcgi
 to use different file than routes.py, if so how do I do it? then i'll
 just have to mess around with my .htaccess

 Thanks


[web2py] web2py 1.82.1 is OUT check it out

2010-08-04 Thread mdipierro
Changelog

#1.82.1
- new template system supports {{block}}, thanks Thadeus
- new db.table(id,[field=value]) and db.table(query) syntax to get
first matching record
- URL('index') (no more r=request), thanks Thadeus
- mail.send(message='html.../html', )
- DAL([uri1, uri2, uri3]) for load balancing
- @service.soap(...) with mysimplesoap, thanks Mariano
- request.ajax to detect if action is called via ajax, tahnks Jonathan
and David Mako
- more captcha options, thanks Vidul
- openid and oauth2 thanks Michele and Keith
- better PluginManager and load components
- FORM(...,hideerror=True) for custom forms


Re: [web2py] web2py 1.82.1 is OUT check it out

2010-08-04 Thread Bruno Rocha
It is going down to zero ??

was 1.84.1, than 1.85. and now it is 1.82???

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

 Changelog

 #1.82.1
 - new template system supports {{block}}, thanks Thadeus
 - new db.table(id,[field=value]) and db.table(query) syntax to get
 first matching record
 - URL('index') (no more r=request), thanks Thadeus
 - mail.send(message='html.../html', )
 - DAL([uri1, uri2, uri3]) for load balancing
 - @service.soap(...) with mysimplesoap, thanks Mariano
 - request.ajax to detect if action is called via ajax, tahnks Jonathan
 and David Mako
 - more captcha options, thanks Vidul
 - openid and oauth2 thanks Michele and Keith
 - better PluginManager and load components
 - FORM(...,hideerror=True) for custom forms




-- 

http://rochacbruno.com.br


Re: [web2py] web2py 1.82.1 is OUT check it out

2010-08-04 Thread Bruno Rocha
I got confused because of this thread..
http://groups.google.com/group/web2py/browse_thread/thread/a1e2b8443ada7198/5e20279c2ba66d88?lnk=gstq=
*1.84*#5e20279c2ba66d88

Sorry...


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

 It is going down to zero ??

 was 1.84.1, than 1.85. and now it is 1.82???

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

 Changelog

 #1.82.1
 - new template system supports {{block}}, thanks Thadeus
 - new db.table(id,[field=value]) and db.table(query) syntax to get
 first matching record
 - URL('index') (no more r=request), thanks Thadeus
 - mail.send(message='html.../html', )
 - DAL([uri1, uri2, uri3]) for load balancing
 - @service.soap(...) with mysimplesoap, thanks Mariano
 - request.ajax to detect if action is called via ajax, tahnks Jonathan
 and David Mako
 - more captcha options, thanks Vidul
 - openid and oauth2 thanks Michele and Keith
 - better PluginManager and load components
 - FORM(...,hideerror=True) for custom forms




 --

 http://rochacbruno.com.br




-- 

http://rochacbruno.com.br


[web2py] Re: web2py 1.82.1 is OUT check it out

2010-08-04 Thread mdipierro
You had me panic for a second. LOL

On Aug 4, 7:11 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 I got confused because of this 
 thread..http://groups.google.com/group/web2py/browse_thread/thread/a1e2b8443a...
 *1.84*#5e20279c2ba66d88

 Sorry...

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



  It is going down to zero ??

  was 1.84.1, than 1.85. and now it is 1.82???

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

  Changelog

  #1.82.1
  - new template system supports {{block}}, thanks Thadeus
  - new db.table(id,[field=value]) and db.table(query) syntax to get
  first matching record
  - URL('index') (no more r=request), thanks Thadeus
  - mail.send(message='html.../html', )
  - DAL([uri1, uri2, uri3]) for load balancing
  - @service.soap(...) with mysimplesoap, thanks Mariano
  - request.ajax to detect if action is called via ajax, tahnks Jonathan
  and David Mako
  - more captcha options, thanks Vidul
  - openid and oauth2 thanks Michele and Keith
  - better PluginManager and load components
  - FORM(...,hideerror=True) for custom forms

  --

 http://rochacbruno.com.br

 --

 http://rochacbruno.com.br


Re: [web2py] Re: web2py 1.82.1 is OUT check it out

2010-08-04 Thread Bruno Rocha
LOL

Really sorry when I read the thread mentioned above got the number on the
head, I even mentioned as being the current version on my site. (just
corrected)

web2py use a crawler to pull the version information directly to the
appadmin. it is possible to embed in any other place?

I i'll take a look into appadmin source now.

Sry...


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

 You had me panic for a second. LOL

 On Aug 4, 7:11 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  I got confused because of this thread..
 http://groups.google.com/group/web2py/browse_thread/thread/a1e2b8443a...
  *1.84*#5e20279c2ba66d88
 
  Sorry...
 
  2010/8/4 Bruno Rocha rochacbr...@gmail.com
 
 
 
   It is going down to zero ??
 
   was 1.84.1, than 1.85. and now it is 1.82???
 
   2010/8/4 mdipierro mdipie...@cs.depaul.edu
 
   Changelog
 
   #1.82.1
   - new template system supports {{block}}, thanks Thadeus
   - new db.table(id,[field=value]) and db.table(query) syntax to get
   first matching record
   - URL('index') (no more r=request), thanks Thadeus
   - mail.send(message='html.../html', )
   - DAL([uri1, uri2, uri3]) for load balancing
   - @service.soap(...) with mysimplesoap, thanks Mariano
   - request.ajax to detect if action is called via ajax, tahnks Jonathan
   and David Mako
   - more captcha options, thanks Vidul
   - openid and oauth2 thanks Michele and Keith
   - better PluginManager and load components
   - FORM(...,hideerror=True) for custom forms
 
   --
 
  http://rochacbruno.com.br
 
  --
 
  http://rochacbruno.com.br




-- 

http://rochacbruno.com.br


Re: [web2py] Re: web2py 1.82.1 is OUT check it out

2010-08-04 Thread Bruno Rocha
Found it: http://web2py.com/examples/default/version

Tks

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

 LOL

 Really sorry when I read the thread mentioned above got the number on the
 head, I even mentioned as being the current version on my site. (just
 corrected)

 web2py use a crawler to pull the version information directly to the
 appadmin. it is possible to embed in any other place?

 I i'll take a look into appadmin source now.

 Sry...


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

 You had me panic for a second. LOL


 On Aug 4, 7:11 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  I got confused because of this thread..
 http://groups.google.com/group/web2py/browse_thread/thread/a1e2b8443a...
  *1.84*#5e20279c2ba66d88
 
  Sorry...
 
  2010/8/4 Bruno Rocha rochacbr...@gmail.com
 
 
 
   It is going down to zero ??
 
   was 1.84.1, than 1.85. and now it is 1.82???
 
   2010/8/4 mdipierro mdipie...@cs.depaul.edu
 
   Changelog
 
   #1.82.1
   - new template system supports {{block}}, thanks Thadeus
   - new db.table(id,[field=value]) and db.table(query) syntax to get
   first matching record
   - URL('index') (no more r=request), thanks Thadeus
   - mail.send(message='html.../html', )
   - DAL([uri1, uri2, uri3]) for load balancing
   - @service.soap(...) with mysimplesoap, thanks Mariano
   - request.ajax to detect if action is called via ajax, tahnks
 Jonathan
   and David Mako
   - more captcha options, thanks Vidul
   - openid and oauth2 thanks Michele and Keith
   - better PluginManager and load components
   - FORM(...,hideerror=True) for custom forms
 
   --
 
  http://rochacbruno.com.br
 
  --
 
  http://rochacbruno.com.br




 --

 http://rochacbruno.com.br




-- 

http://rochacbruno.com.br


[web2py] Re: recaptcha settings RCS update

2010-08-04 Thread Vidul Petrov
Thank you, Massimo!

On Aug 5, 12:39 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Sorry I forgot. It is in trunk now. Please check it. Now I have to
 revise the book once more. :-(

 On Aug 4, 3:55 pm, Vidul Petrov vidul.r...@gmail.com wrote:



  Hi Massimo,

  I sent you an email with a Mercurial diff about retrieve_(username/
  password) settings and captcha:

  diff -r 3e0d95c0a0d5 gluon/tools.py
  --- a/gluon/tools.py    Sun Aug 01 04:53:46 2010 -0500
  +++ b/gluon/tools.py    Sun Aug 01 18:38:00 2010 +0300
  @@ -804,6 +804,8 @@
           self.settings.mailer = None
           self.settings.login_captcha = None
           self.settings.register_captcha = None
  +        self.settings.retrieve_username_captcha = None
  +        self.settings.retrieve_password_captcha = None
           self.settings.captcha = None
           self.settings.expiration = 3600         # one day
           self.settings.long_expiration = 3600*30 # one month
  @@ -1677,7 +1679,8 @@
           request = self.environment.request
           response = self.environment.response
           session = self.environment.session
  -
  +        captcha = self.settings.retrieve_username_captcha or \
  +                (self.settings.retrieve_username_captcha!=False and
  self.settings.captcha)
           if not self.settings.mailer:
               response.flash = self.messages.function_disabled
               return ''
  @@ -1702,6 +1705,10 @@
                          delete_label=self.messages.delete_label,
                          formstyle=self.settings.formstyle
                          )
  +        if captcha:
  +            form[0].insert(-1, TR(LABEL(captcha.label),
  +                                      captcha,captcha.comment,
  +                                      _id = 'capctha__row'))
           if form.accepts(request.post_vars, session,
                           formname='retrieve_username', dbio=False,

  onvalidation=onvalidation,hideerror=self.settings.hideerror):
  @@ -1894,6 +1901,8 @@
           request = self.environment.request
           response = self.environment.response
           session = self.environment.session
  +        captcha = self.settings.retrieve_password_captcha or \
  +                (self.settings.retrieve_password_captcha!=False and
  self.settings.captcha)

           if next == DEFAULT:
               next = request.get_vars._next \
  @@ -1920,6 +1929,10 @@
                          delete_label=self.messages.delete_label,
                          formstyle=self.settings.formstyle
                          )
  +        if captcha:
  +            form[0].insert(-1, TR(LABEL(captcha.label),
  +                                      captcha,captcha.comment,
  +                                      _id = 'capctha__row'))
           if form.accepts(request.post_vars, session,
                           formname='reset_password', dbio=False,

  onvalidation=onvalidation,hideerror=self.settings.hideerror):

  My question is - should I hope to see this in trunk or not?

  I am happy to see so many updates each day, but I am unhappy to see
  that there is not one single web2py version (in other words stable)
  that has no bugs (not to mention fully documented).


[web2py] Custom Authorization

2010-08-04 Thread Ramjee Ganti
Hi All,

Recently started using web2py and python. I am developing a web application.
The authorization scenario is like this:

There is a super user who can access anything. (Essentially he can
create/update/delete categories apart from everything else)
There is a category manager who can update the categories. (each category
has specific settings)
There there is a user who can view the data in a category.

Now any user can be user for a category(say 1), manager for a different
category(say 2). That means the user can see data for both 1 and 2 but can
only modify settings pertaining to 2. He may not be aware of other
categories 3,4. I plan to expose a menu/page where the user can see the
categories and clicking on the  item takes the user to the details (again
with a settings link visible based on role)

How do I go about using the existing auth. in web2py to achieve my goal?

rAm

i Think, i Wait, i Fast -- Siddhartha
http://sodidi.ramjeeganti.com