Re: [web2py:37219] Re: Excess whitespace in html

2009-12-15 Thread Alex Fanjul
Forget my last sentence, Slimmer seems much better solution as Jonathan 
point us.
Alex F

El 15/12/2009 8:59, Alex Fanjul escribió:
 Hi Jonathan, I attatched both html with a very simple example in the 
 email showing double in size. Doesn't appear attached? I always write 
 from Thunderbird, so let me know.

 Massimo, ,maybe not whitespaces but strip more than one consecutive 
 blank lines?
 Alex F

 El 15/12/2009 7:37, Jonathan Lundell escribió:
 On Dec 14, 2009, at 8:39 PM, Alex Fanjul wrote:

 But... what about pages size?
 Doing some very basic test with Denes Example show us that including
 blank lines increase the output page size by *x2 factor* at least (ie.
 67KB vs 130KB).
 Maybe I'm wrong, but, forgetting server deflating (which not everybody
 use), there are a double size in store and transmit bandwidth, that is
 money.

 If it isn't too dificult to implement I would prefer to see it legible
 in 'design' and 'running' time, because many times people review and
 debug webpages over generated code (I guess)
 2x seems like an awful lot, since a newline is only one byte. Are you 
 sure?

 You could try slimmer: http://pypi.python.org/pypi/slimmer/

 -- 

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





-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--

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




Re: [web2py:37220] Re: web2py 1.74.1 is OUT

2009-12-15 Thread Alex Fanjul
MongoDB nicee!!!
I'm willing to see it!
Alex F

El 15/12/2009 5:34, mdipierro escribió:
 I made more changes in new DAL. It is broken badly now because it is
 in a the middle of a major change so that GAE and MongoDB can become
 simple adapters.

 Anyway, it passes some tests. You can try:

 cd gluon
 python dal.py

 Preliminary tests of the functions that work show that selects are 10%
 faster. This was a concern of mine, I thought it was going to be slow.
 No more string comparisons and table lookups.

 Take a look. Advice and comments are appreciated.

 Massimo

 On Dec 14, 10:23 pm, Massimo Di Pierromdipie...@cs.depaul.edu
 wrote:

 It will only upgrade admin, welcome, examples and only overwrite those  
 apps. It will not touch the other apps.

 Anyway. Make a backup first. ;-)

 Massimo

 On Dec 14, 2009, at 9:46 PM, Alex Fanjul wrote:

  
 Hello Massimo,
 With the new characteristic of no need to upgrade, (if I  didn't any
 change to admin or welcome) is it safe to just (copy over) overwrite
 entirely web2py folder and execute python2.5 web2py.py at least  
 one time?

  
 Thanks
 Alex F

  
 El 14/12/2009 17:33, mdipierro escribió:

 New features:
 - Moved to mercurial
 - Default validators use the new define_table(,format='...')
 - New get_vars and post_vars compatible in 2.5 and 2.6 (thanks Tim)
 - Major rewrite of gql.py extends DAL syntax on GAE, supports belongs
 - No more *.w2p, welcome.w2p is create automatically, base apps are
 always upgrade
 - decimal validator allow negative numbers
  
  
 1.74.* is the last version with the old DAL. The new DAL is in gluon/
 dal.py. To try out the new experimenatal DAL do
  
  
  cp gluon/dal.py gluon/sql.py
  
  
 Please report any problem.
  
  
 Massimo
  
  
 --
  
  
 You received this message because you are subscribed to the Google  
 Groups web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com
 .
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en
 .
  
  
 --
 Alejandro Fanjul Fdez.
 alex.fan...@gmail.com
 www.mhproject.org


  
 --

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





-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--

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




[web2py:37221] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread villas
@Thadeus
Thanks for raising this topic.  Tables don't seem correct for laying
out forms any more.  So,  should we assume that we're all heading in
the direction of fieldsets?  Surely fieldsets should eventually be the
default.

Maybe one way forward to is introduce a new option:
renderfieldset=False.  If true we can get a fieldset and drag our
forms into the next generation!

-David

--

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




Re: [web2py:37222] Re: Markdown problem

2009-12-15 Thread Johann Spies
2009/11/26 mdipierro mdipie...@cs.depaul.edu:
 I took a second look.

 WIKI('this bis/b a test').xml()
 'pthis lt;bgt;islt;/bgt; a test/p\n'
 WIKI('this bis/b a test',safe_mode=True).xml()
 'pthis [HTML_REMOVED]is[HTML_REMOVED] a test/p\n'
 WIKI('this bis/b a test',safe_mode=False).xml()
 'pthis bis/b a test/p\n'
 WIKI('this scriptis/script a test',safe_mode=False).xml()
 'pthis scriptis/script a test/p\n'


 It seems safe_mode=False is the way to go but it does do any
 sanitization either.
 This is a problem with the markdown2 library we use.

 For now you can do:

 XML(WIKI('this bis/b a test',safe_mode=False),sanitize=True)

 until I finish rewriting markdown.

Thanks for your reply. I am only now trying it out with the following
in show_page.html:
{{extend 'layout.html'}}

h1{{=page.title}}/h1
 [ {{=A('edit', _href=URL(r=request, f='edit', args=request.args))}}
 | {{=A('documents', _href=URL(r=request, f='documents', args=request.
 args))}} ]br /
 {{import gluon.contrib.markdown}}

  {{=XML(gluon.contrib.markdown.WIKI(page.body,safe_mode=False),sanitize=True)}}
 h2Comments/h2
 {{for comment in comments:}}
   p{{=db.auth_user[comment.created_by].first_name}} on {{=comment.
   created_on}}
   says I{{=comment.body}}/i/p
 {{pass}}
 h2Post a comment/h2
 {{=form}}

And it ends in:


 File /home/js/web2py/gluon/html.py, line 257, in __init__
allowed_attributes)
  File /home/js/web2py/gluon/sanitizer.py, line 190, in sanitize
allowed_attributes=allowed_attributes).strip(text)
  File /home/js/web2py/gluon/sanitizer.py, line 150, in strip
rawstring = rawstring.replace(%s/ % tag, %s / % tag)
AttributeError: 'XML' object has no attribute 'replace'


It is not urgent, just inconvenient. Maybe it is my own mistake somewhere.

Regards
Johann

--

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




[web2py:37223] IronPython 2.6 Final is out

2009-12-15 Thread mr.freeze
http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=12482

--

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




[web2py:37224] Hosting at Webfaction

2009-12-15 Thread annet
I am planning to sign up for a Plan Shared 1 hosting account at
WebFaction for production purposes. So far, I have been developing an
application on my Mac, on which the web2py source code runs out of the
box, and testing it on a Mac Server which I access using Apple Remote
DeskTop. I read the post below, and wonder whether there have been any
changes since it was posted. Further more I have some questions about
it. Step 1 to 3 are clear to me. However, step 4 is a bit cryptic to
me:


Get the latest web2py and copy it into ~/webapps/apachewsgi/:
cd ~/repos/svn #for example
svn checkout http://web2py.googlecode.com/svn/trunk/ web2py-read-
only
svn export web2py-read-only ~/webapps/apachewsgi/web2py

Do I access my account using SSH and run these commands?


cd ~/repos/svn #for example

Means change directory to ~/repos/svn why '# for example'?


svn checkout http://web2py.googlecode.com/svn/trunk/ web2py-read-only

Here I get the latest copy of web2py? Why web2py-read-only?


svn export web2py-read-only ~/webapps/apachewsgi/web2py

... and copy it into ~/webapps/apachewsgi/ why ~/webapps/apachewsgi/
web2py?


On my Mac Server I uploaded the web2py source code from my Mac into my
home folder using sftp and opened web2py_src.zip using the archive
utility, can't I do something similar at WebFaction?


Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:

How do I do that at WebFaction do they provide a texteditor in which
you open the httpd.conf file?


from another terminal, kill web2py process according to web2py's
output instructions

Start your app:
~/webapps/apachewsgi/apach2/bin/start

Here I am completely lost:

from another terminal, kill web2py process according to web2py's
output instructions

What does that mean?


I am apologies for asking so many questions about something as simple
as setting up web2py at WebFaction, but I really haven't got a clue
what some of the instructions are about.


Kind regards,

Annet.


Settting up Web2py as WSGI on Webfaction

Make available two subdomain names, one for adminstration, the other
for public display:
'admin.example.com'
'www.example.com'

Create a webfaction application of type mod_wsgi 2.0/Python 2.5:
'apachewsgi'

Create two webfaction sites that :
'mysite_admin' -- https enabled; subdomain 'admin.example.com';
application 'apachewsgi' served at '/'

'mysite' -- *not* https enabled; subdomain 'www.example.com';
application 'apachewsgi' served at '/'

Get the latest web2py and copy it into ~/webapps/apachewsgi/:
cd ~/repos/svn #for example
svn checkout http://web2py.googlecode.com/svn/trunk/ web2py-read-
only
svn export web2py-read-only ~/webapps/apachewsgi/web2py

Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:
see listing below

in the httpd.conf file, the port number for the app is in line:
Listen 

Create admin password:
in ~/webapps/apachewsgi/web2py:
python2.5 web2py -p   # where  is port number, no
quotes

web2py will ask you for a password, which it will then store in a
file, 'parameters_.py'

from another terminal, kill web2py process according to web2py's
output instructions

Start your app:
~/webapps/apachewsgi/apach2/bin/start

Have fun ?



=  START httpd.conf listing  ==

ServerRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so

# above 6 are added by webfaction; I added mod_alias and mod_access
LoadModule alias_module modules/mod_alias.so
LoadModule access_module modules/mod_access.so

KeepAlive Off
Listen 

WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
wsgihandler.py
WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
 home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
 processes=1 maximum-requests=1000

NameVirtualHost 127.0.0.1:
VirtualHost 127.0.0.1:
ServerName www.example.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
/Directory
/VirtualHost

VirtualHost 127.0.0.1:
ServerName admin.example.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications/admin
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order 

[web2py:37225] Re: check_credentials not working (for me)

2009-12-15 Thread selecta
I just tried again, here are the steps that i did

downloaded web2py Version 1.74.1
logged into the admin
created a new application test
edited the db.py of test to contain
db.define_table('mytable',Field('myfield','string'))
then i click in the edit interface database administration (http://
127.0.0.1:8000/test/appadmin/index)
I get redirected to http://127.0.0.1:8000/admin/default/site


On Dec 15, 2:45 am, Yarko Tymciurak resultsinsoftw...@gmail.com
wrote:
 On Dec 14, 5:49 pm, selecta gr...@delarue-berlin.de wrote:

  Ok sorry for the little info
  I log into the general admin (http://127.0.0.1:8000/admin/default/
  index)
  I create an application
  I try to edit the database with appadmin.py but it just redirectsme
  if I do not comment: if not gluon.fileutils.check_credentials
  (request): redirect(URL(a='admin', c='default', f='index'))

 I am not able to reproduce; here's what I did:

 clean pull, current version from google code;
    Version:  web2py Version 1.74.1 (2009-12-14 10:05:21)

 I create a new app - test
 I edit db.py in test (using admin), add a table:

   db.define_table('test', Field('name'));

 I save, and go to database administration, and add an entry in table
 test --- success (record inpected, seems ok)

 What do you mean when you say I try to edit the database with
 appadmin.py?

 Regards,
 - Yarko





  web2py Version 1.72.3 (2009-11-10 09:17:13)

  On Dec 14, 3:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I am not sure the behavior you experience is wrong. Is this about
   appadmin? Did you try after login in admin? can you show us the
   workflow you experience and what you expect? Which web2py version?

   Massimo

   On Dec 14, 4:06 am, selecta gr...@delarue-berlin.de wrote:

if not gluon.fileutils.check_credentials(request):
redirect(URL(a='admin', c='default', f='index'))

Whenever this line is in my code I always get redirected, I have no
idea what to do to avoid that (other than commenting out this line).

I access the server from localhost with an normal http request.

Please helpme.

--

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




[web2py:37226] Multi language site, long texts

2009-12-15 Thread Arowana
Hello,
I am constucting a multilanguage side, and for singe words and small
sentaces the T(blablabla) works fine.
But what to do about longer texts?

Right now I am using this solution:

{{extend 'layout.html'}}

{{
if not (T.accepted_language == fi-fi):
=XML('''Language 1 html in this string''')
else:
=XML('''Language 2 html in this string''')
}}

Any ideas on a better solution?

Thanks.

--

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




[web2py:37227] Translation issue

2009-12-15 Thread Andrea Cappelli
Hi List,
I'm a web2py user since few months and now I'm dealing with 2 problems
regarding translations

1) With latest release (1.74.1) I get no sentence translated. I have 2
files in languages/ (en.py and it.py) and some symlink (en-us.py, en-
gb.py, it-it.py), but i receive always the text in italian (the
language used as T argument)

2) If I use the old 1.65.1 (rev 992) all seems to work properly, but I
have another problem. I wrote a python script to completely wget all
pages (production server doesn't have python, so i have to put on it
only html/css/js) and always works if I have only one language. If I
have both en.py and it.py strange behaviour appear. The most annoying
thing is that the language file is corrupted by web2py, in it i can
see a comment reporting that the file is utf8 and an open curly
bracket ( '{' ).
Seems that web2py opens the file but for some reason fail when write
to it

There is someone that has similar issues?

--

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




Re: [web2py:37228] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread Alex Fanjul
Very good patch for tableless forms @Thadeus, I think it's a must for 
web2py to be tableless for at least to accomplish AA accesibility w3c.
Alex F

El 15/12/2009 0:00, Thadeus Burgess escribió:
 Take, for example:  http://jeffhowden.com/code/css/forms/

 With a form design as such, you can turn it easily into

 http://www.jankoatwarpspeed.com/post/2009/09/28/webform-wizard-jquery.aspx

 A custom patch seems to be the most appropriate. Create a list, that
 represents the form, and use a function to chop through it.

 I am playing around with the following

 http://pastebin.com/m764d7a39

 Basically, it takes a list of lists, each sublist is a fieldset where
 if a element is a list it is the fieldset title, and if it is a tuple,
 it goes into the notes div.

 It formats the form and looks almost exactly like the one on the
 first link (with the appropriate css. Then using the formtowizard, it
 looks nice :)

 I am actually happier with this, since I believe allows for the most
 customization as far as form content goes.

 SQLFORM does need to be refactored into more MVC format I am
 thinking of SQLFORM only making the data ready, and performing the
 validation, and have a separate class that creates and renders the
 form elements.

 -Thadeus





 On Mon, Dec 14, 2009 at 4:20 PM, DenesLdenes1...@yahoo.ca  wrote:

 Many moons have passed since I last looked at this but if I remember
 correctly I went for a class that was based on SQLFORM (currently
 sitting in the back burner).

 SQLFORM mixes processing and presentation very tightly, which is fine
 for starters but you soon get to a point where you want to keep the
 processing but have a completely different presentation.

 My initial approach was the 'custom form' patch which is fine but
 somewhat cumbersome.
 The lastest is CSS based and it would allow easy form customization if
 I can iron out some pending issues. I would love to hear your ideas,
 specially about CSS.

 Denes.


 On Dec 14, 12:51 pm, Thadeus Burgessthade...@thadeusb.com  wrote:
  
 I would like to accomplish the output of the below, but use SQLFORM,
 and not mess with sqlform.custom.

 form = FORM(
  FIELDSET(
  LEGEND(Your Information),
  LABEL(Name:, _for=name),
  INPUT(_name=name),
  LABEL(Email:, _for=email),
  INPUT(_name=email),
  LABEL(Country:, _for=country),
  INPUT(_name=country),
  ),
  FIELDSET(
  LEGEND(Account Info),
  LABEL(Username:, _for=username),
  INPUT(_name=username),
  LABEL(Password:, _for=password),
  INPUT(_name=password),
  LABEL(Password Again:, _for=passwordrpt),
  INPUT(_name=passwordrpt),
  ),
  )

 I am thinking an interface that allows mixing and matching of DIV
 based objects and fields.
 Should I a new form class be created, or a class that uses an existing
 forms sqlform.custom?

 Does anyone have any ideas on the best way to implement the functionality?

 SQLFORM.factory(
 FIELDSET(
 LEGEND(Your Information),
 db.accounts.name,
 db.accounts.email,
 db.accounts.country,
), FIELDSET(
 LEGEND(Account Info),
 db.accounts.username,
 db.accounts.password,
 db.accounts.passwordrpt,
   ),
 )

 Also on a side note, You can get the same functionality of forms (the
 table like layout) with pure CSS. I keep wondering why a TABLE was
 chosen for default forms, since it makes it impossible to style the
 form **layout** with CSS.

 -Thadeus

 --

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



  
 --

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





-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--

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




[web2py:37229] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread mdipierro
There is no reason to make SQLFORM more complex than it is. Why not
move some of the SQLFORM logic into a new object SMARTFORM(?) and
behaves like FORM but accepts Fields as helpers and processes them
like SQLFORM? parhaps SQLFORM could be derived from such a beast.

Massimo

On Dec 15, 6:06 am, villas villa...@gmail.com wrote:
 @Thadeus
 Thanks for raising this topic.  Tables don't seem correct for laying
 out forms any more.  So,  should we assume that we're all heading in
 the direction of fieldsets?  Surely fieldsets should eventually be the
 default.

 Maybe one way forward to is introduce a new option:
 renderfieldset=False.  If true we can get a fieldset and drag our
 forms into the next generation!

 -David

--

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




[web2py:37230] Re: Markdown problem

2009-12-15 Thread mdipierro
XML(gluon.contrib.markdown.WIKI
(page.body,safe_mode=False),sanitize=True)}}

should be

XML(gluon.contrib.markdown.WIKI(page.body,safe_mode=False).xml
(),sanitize=True)}}

On Dec 15, 7:31 am, Johann Spies johann.sp...@gmail.com wrote:
 2009/11/26 mdipierro mdipie...@cs.depaul.edu:



  I took a second look.

  WIKI('this bis/b a test').xml()
  'pthis lt;bgt;islt;/bgt; a test/p\n'
  WIKI('this bis/b a test',safe_mode=True).xml()
  'pthis [HTML_REMOVED]is[HTML_REMOVED] a test/p\n'
  WIKI('this bis/b a test',safe_mode=False).xml()
  'pthis bis/b a test/p\n'
  WIKI('this scriptis/script a test',safe_mode=False).xml()
  'pthis scriptis/script a test/p\n'

  It seems safe_mode=False is the way to go but it does do any
  sanitization either.
  This is a problem with the markdown2 library we use.

  For now you can do:

  XML(WIKI('this bis/b a test',safe_mode=False),sanitize=True)

  until I finish rewriting markdown.

 Thanks for your reply. I am only now trying it out with the following
 in show_page.html:
 {{extend 'layout.html'}}

 h1{{=page.title}}/h1
  [ {{=A('edit', _href=URL(r=request, f='edit', args=request.args))}}
  | {{=A('documents', _href=URL(r=request, f='documents', args=request.
      args))}} ]br /
  {{import gluon.contrib.markdown}}

   
 {{=XML(gluon.contrib.markdown.WIKI(page.body,safe_mode=False),sanitize=True)}}
  h2Comments/h2
  {{for comment in comments:}}
    p{{=db.auth_user[comment.created_by].first_name}} on {{=comment.
        created_on}}
            says I{{=comment.body}}/i/p
  {{pass}}
  h2Post a comment/h2
  {{=form}}

 And it ends in:

  File /home/js/web2py/gluon/html.py, line 257, in __init__
     allowed_attributes)
   File /home/js/web2py/gluon/sanitizer.py, line 190, in sanitize
     allowed_attributes=allowed_attributes).strip(text)
   File /home/js/web2py/gluon/sanitizer.py, line 150, in strip
     rawstring = rawstring.replace(%s/ % tag, %s / % tag)
 AttributeError: 'XML' object has no attribute 'replace'

 It is not urgent, just inconvenient. Maybe it is my own mistake somewhere.

 Regards
 Johann

--

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




[web2py:37231] Re: Hosting at Webfaction

2009-12-15 Thread mdipierro
would you post a slice?

On Dec 15, 8:55 am, annet annet.verm...@gmail.com wrote:
 I am planning to sign up for a Plan Shared 1 hosting account at
 WebFaction for production purposes. So far, I have been developing an
 application on my Mac, on which the web2py source code runs out of the
 box, and testing it on a Mac Server which I access using Apple Remote
 DeskTop. I read the post below, and wonder whether there have been any
 changes since it was posted. Further more I have some questions about
 it. Step 1 to 3 are clear to me. However, step 4 is a bit cryptic to
 me:

 Get the latest web2py and copy it into ~/webapps/apachewsgi/:
     cd ~/repos/svn #for example
     svn checkouthttp://web2py.googlecode.com/svn/trunk/web2py-read-
 only
     svn export web2py-read-only ~/webapps/apachewsgi/web2py

 Do I access my account using SSH and run these commands?

 cd ~/repos/svn #for example

 Means change directory to ~/repos/svn why '# for example'?

 svn checkouthttp://web2py.googlecode.com/svn/trunk/web2py-read-only

 Here I get the latest copy of web2py? Why web2py-read-only?

 svn export web2py-read-only ~/webapps/apachewsgi/web2py

 ... and copy it into ~/webapps/apachewsgi/ why ~/webapps/apachewsgi/
 web2py?

 On my Mac Server I uploaded the web2py source code from my Mac into my
 home folder using sftp and opened web2py_src.zip using the archive
 utility, can't I do something similar at WebFaction?

 Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:

 How do I do that at WebFaction do they provide a texteditor in which
 you open the httpd.conf file?

 from another terminal, kill web2py process according to web2py's
 output instructions

 Start your app:
     ~/webapps/apachewsgi/apach2/bin/start

 Here I am completely lost:

 from another terminal, kill web2py process according to web2py's
 output instructions

 What does that mean?

 I am apologies for asking so many questions about something as simple
 as setting up web2py at WebFaction, but I really haven't got a clue
 what some of the instructions are about.

 Kind regards,

 Annet.

 Settting up Web2py as WSGI on Webfaction

 Make available two subdomain names, one for adminstration, the other
 for public display:
     'admin.example.com'
     'www.example.com'

 Create a webfaction application of type mod_wsgi 2.0/Python 2.5:
     'apachewsgi'

 Create two webfaction sites that :
     'mysite_admin' -- https enabled; subdomain 'admin.example.com';
 application 'apachewsgi' served at '/'

     'mysite' -- *not* https enabled; subdomain 'www.example.com';
 application 'apachewsgi' served at '/'

 Get the latest web2py and copy it into ~/webapps/apachewsgi/:
     cd ~/repos/svn #for example
     svn checkouthttp://web2py.googlecode.com/svn/trunk/web2py-read-
 only
     svn export web2py-read-only ~/webapps/apachewsgi/web2py

 Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:
     see listing below

     in the httpd.conf file, the port number for the app is in line:
         Listen 

 Create admin password:
     in ~/webapps/apachewsgi/web2py:
         python2.5 web2py -p       # where  is port number, no
 quotes

     web2py will ask you for a password, which it will then store in a
 file, 'parameters_.py'

     from another terminal, kill web2py process according to web2py's
 output instructions

 Start your app:
     ~/webapps/apachewsgi/apach2/bin/start

 Have fun ?

 =  START httpd.conf listing  ==

 ServerRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2

 LoadModule dir_module modules/mod_dir.so
 LoadModule env_module modules/mod_env.so
 LoadModule log_config_module modules/mod_log_config.so
 LoadModule mime_module modules/mod_mime.so
 LoadModule rewrite_module modules/mod_rewrite.so
 LoadModule wsgi_module modules/mod_wsgi.so

 # above 6 are added by webfaction; I added mod_alias and mod_access
 LoadModule alias_module modules/mod_alias.so
 LoadModule access_module modules/mod_access.so

 KeepAlive Off
 Listen 

 WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 wsgihandler.py
 WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
      home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
      processes=1 maximum-requests=1000

 NameVirtualHost 127.0.0.1:
 VirtualHost 127.0.0.1:
     ServerNamewww.example.com
     DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 applications
     Directory /
             Options FollowSymLinks
             AllowOverride None
     /Directory
     Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
             Options Indexes FollowSymLinks MultiViews
             AllowOverride None
             Order allow,deny
             allow from all
     /Directory
 /VirtualHost

 VirtualHost 127.0.0.1:
     ServerName admin.example.com
     DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 applications/admin
     Directory /
             Options FollowSymLinks
             AllowOverride None
 

[web2py:37232] Re: Multi language site, long texts

2009-12-15 Thread mdipierro
What is wrong with?

{{=T(your long text)}}

why does it matter if the text is long? Is it because you have HTML in
the translation?

Massimo

On Dec 15, 4:18 am, Arowana west.fi...@gmail.com wrote:
 Hello,
 I am constucting a multilanguage side, and for singe words and small
 sentaces the T(blablabla) works fine.
 But what to do about longer texts?

 Right now I am using this solution:

 {{extend 'layout.html'}}

 {{
 if not (T.accepted_language == fi-fi):
     =XML('''Language 1 html in this string''')
 else:
     =XML('''Language 2 html in this string''')

 }}

 Any ideas on a better solution?

 Thanks.

--

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




[web2py:37233] Re: Translation issue

2009-12-15 Thread mdipierro


On Dec 15, 8:56 am, Andrea Cappelli a.cappe...@gmail.com wrote:
 Hi List,
 I'm a web2py user since few months and now I'm dealing with 2 problems
 regarding translations

 1) With latest release (1.74.1) I get no sentence translated. I have 2
 files in languages/ (en.py and it.py) and some symlink (en-us.py, en-
 gb.py, it-it.py), but i receive always the text in Italian (the
 language used as T argument).

We had a long discussion about this. We had a minor change of behavior
that basically assumes the default language is English. We did not
make such assumptions before. I opposed such change but apparently I
was the only one and everybody else spoke for it. Now you have to be
explicit about the fact that your language is Italian (somewhere
before you use T):

   T.current_languages=['it','it-it']


 2) If I use the old 1.65.1 (rev 992) all seems to work properly, but I
 have another problem. I wrote a python script to completely wget all
 pages (production server doesn't have python, so i have to put on it
 only html/css/js) and always works if I have only one language. If I
 have both en.py and it.py strange behaviour appear. The most annoying
 thing is that the language file is corrupted by web2py, in it i can
 see a comment reporting that the file is utf8 and an open curly
 bracket ( '{' ).
 Seems that web2py opens the file but for some reason fail when write
 to it

This may be a concurrency issue. Make sure you lock the file while
writing in it from a your own python program.

--

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




[web2py:37234] news blobstore on gae

2009-12-15 Thread mdipierro
This is a good time to be rewriting the DAL:

http://googleappengine.blogspot.com/2009/12/app-engine-sdk-130-released-including.html

We should take advantage of this.

--

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




[web2py:37235] Re: Excess whitespace in html

2009-12-15 Thread kbochert
Jonathon wrote:
 2x seems like an awful lot, since a newline is only one byte. Are you sure?

The  output typically has multiple leading spaces on those blank
lines, presumably driven by the indenting of the original html.

DenesL wrote:
 Do you want you view or your final output to be legible and
 aesthetically pleasing according to some subjective human standard?.

Absolutely!
For instance,  I'm currently looking for a designer to style my site.
The first thing I do is surf to their home page and look at its source
code!
If I'm evangelizing web2py to colleagues, clean output helps. (makes
me prouder of my work, at least)


I tried massimos' code snippet
def filter(d):
import re
if isinstance(d,dict):
 return re.compile('\n\n').sub('\n',response.render(d))
return d
response._caller=filter

It failed, generating pages with a single line of html function
index at 0x01A04C70
  -- but --

def filter(d):
import re
if isinstance(d,dict):
 return re.compile('\n\s\s+\n').sub('\n',response.render(d))
return re.compile('\n\s\s+\n').sub('\n',response.render(d()))
response._caller=filter

worked !beautifully!  When I take care to write the template cleanly,
the rendering is also clean.

This makes a distinction between empty lines (with no characters), and
blank lines (containing only whitespace chars).
blank lines are removed, empty lines are not. (whitespace matters!)


It would be nice if web2py could make this its default rendering
behavior.

Are there other issues than pre blocks?


Karl



--

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




Re: [web2py:37236] Re: Excess whitespace in html

2009-12-15 Thread Jonathan Lundell
On Dec 15, 2009, at 8:13 AM, kbochert wrote:

 Jonathon wrote:
 2x seems like an awful lot, since a newline is only one byte. Are you sure?
 
 The  output typically has multiple leading spaces on those blank
 lines, presumably driven by the indenting of the original html.

I finally noticed the attachments. It does seem like a pathological case, 
though (v. short lines and lots of whitespace).


 
 DenesL wrote:
 Do you want you view or your final output to be legible and
 aesthetically pleasing according to some subjective human standard?.
 
 Absolutely!
 For instance,  I'm currently looking for a designer to style my site.
 The first thing I do is surf to their home page and look at its source
 code!
 If I'm evangelizing web2py to colleagues, clean output helps. (makes
 me prouder of my work, at least)

I agree that good-looking output is a plus. It doesn't seem unreasonable to ask 
developers to understand how web2py templates work, and design accordingly. 
It's not a mystery where the white space is coming from, and the developer has 
complete control.

One problem, though, is that there *is* a conflict between good-looking (and 
readable, and maintainable) template source, and the appearance of the output. 
We use (and should use) white space liberally to make our code readable. If 
that same white space leaks into the output, it generally looks pretty random.

Those of us that write straight html are doing both at the same time. Our html 
needs to be maintainable *as source*. A different standard needs to be applied 
to generated html, since it won't be (directly) maintained.

What I like about using a filter (slimmer or the like) is that it leaves you 
free to write readable source, and end up with decent output.

--

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




[web2py:37237] Re: Hosting at Webfaction

2009-12-15 Thread Mengu
dear annet,

when you start web2py with the command python web2py.py, it outputs
something like this:
please visit:
http://127.0.0.1:8000
use kill -SIGTERM 9813 to shutdown the web2py server

so basically, you need to fire up another terminal window to ssh into
your webfaction account and use kill -SIGTERM 9813. that's what it
means.

On Dec 15, 4:55 pm, annet annet.verm...@gmail.com wrote:
 I am planning to sign up for a Plan Shared 1 hosting account at
 WebFaction for production purposes. So far, I have been developing an
 application on my Mac, on which the web2py source code runs out of the
 box, and testing it on a Mac Server which I access using Apple Remote
 DeskTop. I read the post below, and wonder whether there have been any
 changes since it was posted. Further more I have some questions about
 it. Step 1 to 3 are clear to me. However, step 4 is a bit cryptic to
 me:

 Get the latest web2py and copy it into ~/webapps/apachewsgi/:
     cd ~/repos/svn #for example
     svn checkouthttp://web2py.googlecode.com/svn/trunk/web2py-read-
 only
     svn export web2py-read-only ~/webapps/apachewsgi/web2py

 Do I access my account using SSH and run these commands?

 cd ~/repos/svn #for example

 Means change directory to ~/repos/svn why '# for example'?

 svn checkouthttp://web2py.googlecode.com/svn/trunk/web2py-read-only

 Here I get the latest copy of web2py? Why web2py-read-only?

 svn export web2py-read-only ~/webapps/apachewsgi/web2py

 ... and copy it into ~/webapps/apachewsgi/ why ~/webapps/apachewsgi/
 web2py?

 On my Mac Server I uploaded the web2py source code from my Mac into my
 home folder using sftp and opened web2py_src.zip using the archive
 utility, can't I do something similar at WebFaction?

 Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:

 How do I do that at WebFaction do they provide a texteditor in which
 you open the httpd.conf file?

 from another terminal, kill web2py process according to web2py's
 output instructions

 Start your app:
     ~/webapps/apachewsgi/apach2/bin/start

 Here I am completely lost:

 from another terminal, kill web2py process according to web2py's
 output instructions

 What does that mean?

 I am apologies for asking so many questions about something as simple
 as setting up web2py at WebFaction, but I really haven't got a clue
 what some of the instructions are about.

 Kind regards,

 Annet.

 Settting up Web2py as WSGI on Webfaction

 Make available two subdomain names, one for adminstration, the other
 for public display:
     'admin.example.com'
     'www.example.com'

 Create a webfaction application of type mod_wsgi 2.0/Python 2.5:
     'apachewsgi'

 Create two webfaction sites that :
     'mysite_admin' -- https enabled; subdomain 'admin.example.com';
 application 'apachewsgi' served at '/'

     'mysite' -- *not* https enabled; subdomain 'www.example.com';
 application 'apachewsgi' served at '/'

 Get the latest web2py and copy it into ~/webapps/apachewsgi/:
     cd ~/repos/svn #for example
     svn checkouthttp://web2py.googlecode.com/svn/trunk/web2py-read-
 only
     svn export web2py-read-only ~/webapps/apachewsgi/web2py

 Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:
     see listing below

     in the httpd.conf file, the port number for the app is in line:
         Listen 

 Create admin password:
     in ~/webapps/apachewsgi/web2py:
         python2.5 web2py -p       # where  is port number, no
 quotes

     web2py will ask you for a password, which it will then store in a
 file, 'parameters_.py'

     from another terminal, kill web2py process according to web2py's
 output instructions

 Start your app:
     ~/webapps/apachewsgi/apach2/bin/start

 Have fun ?

 =  START httpd.conf listing  ==

 ServerRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2

 LoadModule dir_module modules/mod_dir.so
 LoadModule env_module modules/mod_env.so
 LoadModule log_config_module modules/mod_log_config.so
 LoadModule mime_module modules/mod_mime.so
 LoadModule rewrite_module modules/mod_rewrite.so
 LoadModule wsgi_module modules/mod_wsgi.so

 # above 6 are added by webfaction; I added mod_alias and mod_access
 LoadModule alias_module modules/mod_alias.so
 LoadModule access_module modules/mod_access.so

 KeepAlive Off
 Listen 

 WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 wsgihandler.py
 WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
      home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
      processes=1 maximum-requests=1000

 NameVirtualHost 127.0.0.1:
 VirtualHost 127.0.0.1:
     ServerNamewww.example.com
     DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 applications
     Directory /
             Options FollowSymLinks
             AllowOverride None
     /Directory
     Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
             Options Indexes FollowSymLinks MultiViews
             AllowOverride None
   

[web2py:37238] Re: ldap authentication stopped working: enter a valid email address

2009-12-15 Thread Fred
The Auth.login() method in tools.py is causing my grief.  It's setting
a temporary IS_EMAIL() validator on the auth_user.email field during
login.

I've been using the standard Auth tables along with LDAP
authentication successfully, in production, for months.  That scheme
stores the LDAP username in the auth_user.email field.  But now it
seems that newer Auth code wants there to be a 'username' field in the
auth_user table to avoid the IS_EMAIL() check during login.

This is a pain.  It's not backward compatible for one.  I see in the
v2 manual the explanation of how to define auth_user from scratch and
add a 'username' field that way.  I've got several apps in production
and don't want to update all their models with that mess.  I'm
experimenting with patching tools.py to conditionally define a
auth_user.username field based on a new Auth.settings.username_field
parameter which I can set in the models.  That's going OK except that
I'm seeing new rows added to auth_user as I login with usernames that
I've already logged in with before.

--

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




[web2py:37239] Re: sign in form , email field validation problem

2009-12-15 Thread Fred
This patch seems to be causing me grief with LDAP authentication.  See
http://groups.google.com/group/web2py/browse_thread/thread/043083b6ae706f22

--

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




Re: [web2py:37240] Re: Translation issue

2009-12-15 Thread Andrea Cappelli
Il giorno mar, 15/12/2009 alle 07.37 -0800, mdipierro ha scritto:

 We had a long discussion about this. We had a minor change of behavior
 that basically assumes the default language is English. We did not
 make such assumptions before. I opposed such change but apparently I
 was the only one and everybody else spoke for it. Now you have to be
 explicit about the fact that your language is Italian (somewhere
 before you use T):
 
T.current_languages=['it','it-it']

Thank you, using your suggestion I found the solution which consist in
calling the following function in every controller:

def set_default_language(T, request):
# We assume the project is in italian language
T.current_languages = ['it','it-it']

# Get choosen language from the user
lang = request.env.http_accept_language.split(,)[0]

if lang.find('-') != -1:
lang = lang.split('-')[0]

T.force(lang)


 This may be a concurrency issue. Make sure you lock the file while
 writing in it from a your own python program.

You are right, I think the problem is that in the earlier version there
were no lock on language file.

A diff from my revision (992) and the latest (1458) shows that you
change the way the language file is opened

def write_dict(filename, contents):
-f = open(filename, 'w')
-f.write('{\n')
+fp = open(filename, 'w')
+portalocker.lock(fp, portalocker.LOCK_EX)
+fp.write('# coding: utf8\n{\n')
 for key in sorted(contents):
-f.write('%s: %s,\n' % (repr(key), repr(contents[key])))
-f.write('}\n')
-f.close()
+fp.write('%s: %s,\n' % (repr(key), repr(contents[key])))
+fp.write('}\n')
+portalocker.unlock(fp)
+fp.close()

So I needed the latest revision to fix the main issue, but without the
fix you suggest me I wasn't able to get it work

Thank you very much


--

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




[web2py:37241] Re: ldap authentication stopped working: enter a valid email address

2009-12-15 Thread mdipierro
I'd say it is a big that is stores username in the email field.
It should use a 'username' field.

I will look into this but for now my suggestion is edit tools and
change

if 'username' in table_user.fields:
username = 'username'
tmpvalidator = IS_NOT_EMPTY(self.messages.is_empty)
else:
username = 'email'
tmpvalidator = IS_EMAIL(self.messages.invalid_email)


into this

username = 'email'
tmpvalidator = IS_EMAIL(self.messages.invalid_email)

Sorry for this problem.

On Dec 15, 11:20 am, Fred fre...@gmail.com wrote:
 The Auth.login() method in tools.py is causing my grief.  It's setting
 a temporary IS_EMAIL() validator on the auth_user.email field during
 login.

 I've been using the standard Auth tables along with LDAP
 authentication successfully, in production, for months.  That scheme
 stores the LDAP username in the auth_user.email field.  But now it
 seems that newer Auth code wants there to be a 'username' field in the
 auth_user table to avoid the IS_EMAIL() check during login.

 This is a pain.  It's not backward compatible for one.  I see in the
 v2 manual the explanation of how to define auth_user from scratch and
 add a 'username' field that way.  I've got several apps in production
 and don't want to update all their models with that mess.  I'm
 experimenting with patching tools.py to conditionally define a
 auth_user.username field based on a new Auth.settings.username_field
 parameter which I can set in the models.  That's going OK except that
 I'm seeing new rows added to auth_user as I login with usernames that
 I've already logged in with before.

--

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




[web2py:37242] Re: sign in form , email field validation problem

2009-12-15 Thread mdipierro
I agree. The problem is that LDAP should be using the email field to
get a username.

On Dec 15, 11:23 am, Fred fre...@gmail.com wrote:
 This patch seems to be causing me grief with LDAP authentication.  
 Seehttp://groups.google.com/group/web2py/browse_thread/thread/043083b6ae...

--

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




[web2py:37243] pyforum vulnerabilities?

2009-12-15 Thread mdipierro
There are a number of security advisory reports online about pyforum,
some from reputable sources.

They report two vulnerabilities:

1) What they refer to as a backdoor but they describe as a different
problem: an attacker can force pyforum to email a new password to the
administrator (not to the attacker himself). If true this is not a
major problem but it may be annoying for the administrator.

2) There is a XSS vulnerability. If true, is major security issue but
it would be trivial to fix using XML(...,sanitize=True).

I have not looked at the source code.
Somebody should look into this and fix it or respond to the security
advisory.

Massimo

--

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




[web2py:37244] Using db in uploaded modules

2009-12-15 Thread Hillman
I have a module that I uploaded to an application, and I was wondering
if there is a way that I can access my databases within the module. I
imagine it is just a matter of importing the right things, but I don't
know what all I need to import.

--

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




[web2py:37245] Re: Using db in uploaded modules

2009-12-15 Thread mdipierro
Is the module imported by web2py? If not you need to pass the db to
thsoe functions/classes defined in the module that need to use it.

Else you should probably run web2py -S app -M -R yourmodule.py

On Dec 15, 12:28 pm, Hillman hillma...@gmail.com wrote:
 I have a module that I uploaded to an application, and I was wondering
 if there is a way that I can access my databases within the module. I
 imagine it is just a matter of importing the right things, but I don't
 know what all I need to import.

--

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




[web2py:37246] Re: check_credentials not working (for me)

2009-12-15 Thread Yarko Tymciurak
On Dec 15, 9:04 am, selecta gr...@delarue-berlin.de wrote:
 I just tried again, here are the steps that i did

 downloaded web2py Version 1.74.1
 logged into the admin
 created a new application test
 edited the db.py of test to contain
 db.define_table('mytable',Field('myfield','string'))
 then i click in the edit interface database administration (http://
 127.0.0.1:8000/test/appadmin/index)
 I get redirected tohttp://127.0.0.1:8000/admin/default/site

When I do a clean checkout of web2py from hg, I do not get this.

Try doing an absolutely clean checkout, and see if this still happens
for you:

 hg clone https://web2py.googlecode.com/hg/ my-clean-web2py


 On Dec 15, 2:45 am, Yarko Tymciurak resultsinsoftw...@gmail.com
 wrote:



  On Dec 14, 5:49 pm, selecta gr...@delarue-berlin.de wrote:

   Ok sorry for the little info
   I log into the general admin (http://127.0.0.1:8000/admin/default/
   index)
   I create an application
   I try to edit the database with appadmin.py but it just redirectsme
   if I do not comment: if not gluon.fileutils.check_credentials
   (request): redirect(URL(a='admin', c='default', f='index'))

  I am not able to reproduce; here's what I did:

  clean pull, current version from google code;
     Version:  web2py Version 1.74.1 (2009-12-14 10:05:21)

  I create a new app - test
  I edit db.py in test (using admin), add a table:

    db.define_table('test', Field('name'));

  I save, and go to database administration, and add an entry in table
  test --- success (record inpected, seems ok)

  What do you mean when you say I try to edit the database with
  appadmin.py?

  Regards,
  - Yarko

   web2py Version 1.72.3 (2009-11-10 09:17:13)

   On Dec 14, 3:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

I am not sure the behavior you experience is wrong. Is this about
appadmin? Did you try after login in admin? can you show us the
workflow you experience and what you expect? Which web2py version?

Massimo

On Dec 14, 4:06 am, selecta gr...@delarue-berlin.de wrote:

 if not gluon.fileutils.check_credentials(request):
 redirect(URL(a='admin', c='default', f='index'))

 Whenever this line is in my code I always get redirected, I have no
 idea what to do to avoid that (other than commenting out this line).

 I access the server from localhost with an normal http request.

 Please helpme.

--

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




[web2py:37247] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread mr.freeze
This just added: column filtering!  You can now set filters per
column. This will render dropdowns of all of the possible values for
your field. The slice has been updated with screenshot and usages
instructions.


On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
 On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:

  Just added: multiple grids per page is supported now!

 Very useful. Thanks for your further explanations too.
 -David

--

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




[web2py:37248] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread mr.freeze
And here's the link again: http://www.web2pyslices.com/main/slices/take_slice/39

On Dec 15, 1:03 pm, mr.freeze nat...@freezable.com wrote:
 This just added: column filtering!  You can now set filters per
 column. This will render dropdowns of all of the possible values for
 your field. The slice has been updated with screenshot and usages
 instructions.

 On Dec 12, 7:32 am, villas villa...@gmail.com wrote:

  On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:

   Just added: multiple grids per page is supported now!

  Very useful. Thanks for your further explanations too.
  -David



--

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




Re: [web2py:37249] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread Alexandre Andrade
I need to personalize edit link to a custom page, where I use request.arg(0)

http://localhost/default/custo/11

but i need to know what form to use and the id of row. The link would be
like:


http://localhost/default/custo/11/custo_pessoal/12


how personalize it in

grid.edit_link = lambda row: ...

???


Thanks in advance.



2009/12/15 mr.freeze nat...@freezable.com

 This just added: column filtering!  You can now set filters per
 column. This will render dropdowns of all of the possible values for
 your field. The slice has been updated with screenshot and usages
 instructions.


 On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
  On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:
 
   Just added: multiple grids per page is supported now!
 
  Very useful. Thanks for your further explanations too.
  -David

 --

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





-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

--

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




[web2py:37250] Re: Translation issue

2009-12-15 Thread Yarko Tymciurak

On Dec 15, 11:23 am, Andrea Cappelli a.cappe...@gmail.com wrote:
 Il giorno mar, 15/12/2009 alle 07.37 -0800, mdipierro ha scritto:

  We had a long discussion about this. We had a minor change of behavior
  that basically assumes the default language is English. We did not
  make such assumptions before. I opposed such change but apparently I
  was the only one and everybody else spoke for it. Now you have to be
  explicit about the fact that your language is Italian (somewhere
  before you use T):

We need to be careful when describing this:

What web2py DID NOT do before is initialize (for translation) what the
language of the source (the application)  was.

This caused problems when viewing sites if the client had a list of
acceptable delivery languages.

The solution was to be sure web2py had SOME DEFAULT definition for
what the language of the strings within applications is (so that the
correct translation texts would be selected).

Since web2py is written in Chicago, IL,  the default language declared
was (naturally)  'en'.


     T.current_languages=['it','it-it']

 Thank you, using your suggestion I found the solution which consist in
 calling the following function in every controller:

You do not need to do this in every controller (although you _can_,
unless you have a language course as the application, you probably do
not _want_ to!)

If you put  the line Massimo suggests in your models folder (you can
put it in db.py, or you can create a file, something like
application_language.py - as long as this is defined in _some_ model
file, it will define for all your controllers).


 def set_default_language(T, request):
     # We assume the project is in italian language
     T.current_languages = ['it','it-it']

This is a unfortunate naming of this variable - it is confusing...
I should have named it T.app_language (and it should have only been a
single language, as it makes no sense that a string from the source of
your application is simultaneously _two_ languages!).  Please
forgive us, forgive _me_ for the confusion (I submitted the patch, and
should have made things clearer).

In any case, you should - in model/db.py - simply declare what the
default language of the source of the application is.


     # Get choosen language from the user    
     lang = request.env.http_accept_language.split(,)[0]

     if lang.find('-') != -1:
         lang = lang.split('-')[0]

     T.force(lang)

If you properly make the setting I mention above, the translation
mechanism will do this - YOU should not be doing this (somehow I think
this code is then directly competing with T('some string') - and I
think the T() code will just repeatedly override at each request what
you have here in any case, it is not a good thing, do not do this
here.

I hope this helps.

Regards,
- Yarko


  This may be a concurrency issue. Make sure you lock the file while
  writing in it from a your own python program.

 You are right, I think the problem is that in the earlier version there
 were no lock on language file.

 A diff from my revision (992) and the latest (1458) shows that you
 change the way the language file is opened

 def write_dict(filename, contents):
 -    f = open(filename, 'w')
 -    f.write('{\n')
 +    fp = open(filename, 'w')
 +    portalocker.lock(fp, portalocker.LOCK_EX)
 +    fp.write('# coding: utf8\n{\n')
      for key in sorted(contents):
 -        f.write('%s: %s,\n' % (repr(key), repr(contents[key])))
 -    f.write('}\n')
 -    f.close()
 +        fp.write('%s: %s,\n' % (repr(key), repr(contents[key])))
 +    fp.write('}\n')
 +    portalocker.unlock(fp)
 +    fp.close()

 So I needed the latest revision to fix the main issue, but without the
 fix you suggest me I wasn't able to get it work

 Thank you very much

--

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




[web2py:37251] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread mr.freeze
If your datasource is not a join:
grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
   args=
[request.args(0), self.tablenames[0], row['id']]))

If it is a join:
grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
   args=
[request.args(0), self.tablenames[0],
 row
[self.tablenames[0]]['id']]))



On Dec 15, 1:10 pm, Alexandre Andrade alexandrema...@gmail.com
wrote:
 I need to personalize edit link to a custom page, where I use request.arg(0)

 http://localhost/default/custo/11

 but i need to know what form to use and the id of row. The link would be
 like:

 http://localhost/default/custo/11/custo_pessoal/12

 how personalize it in

 grid.edit_link = lambda row: ...

 ???

 Thanks in advance.

 2009/12/15 mr.freeze nat...@freezable.com



  This just added: column filtering!  You can now set filters per
  column. This will render dropdowns of all of the possible values for
  your field. The slice has been updated with screenshot and usages
  instructions.

  On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
   On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:

Just added: multiple grids per page is supported now!

   Very useful. Thanks for your further explanations too.
   -David

  --

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

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

--

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




[web2py:37252] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread mr.freeze
Looks like filters and paging aren't working together. I should have
it fixed soon.

On Dec 15, 1:32 pm, mr.freeze nat...@freezable.com wrote:
 If your datasource is not a join:
 grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
                                                        args=
 [request.args(0), self.tablenames[0], row['id']]))

 If it is a join:
 grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
                                                        args=
 [request.args(0), self.tablenames[0],
                                                              row
 [self.tablenames[0]]['id']]))

 On Dec 15, 1:10 pm, Alexandre Andrade alexandrema...@gmail.com
 wrote:

  I need to personalize edit link to a custom page, where I use request.arg(0)

 http://localhost/default/custo/11

  but i need to know what form to use and the id of row. The link would be
  like:

 http://localhost/default/custo/11/custo_pessoal/12

  how personalize it in

  grid.edit_link = lambda row: ...

  ???

  Thanks in advance.

  2009/12/15 mr.freeze nat...@freezable.com

   This just added: column filtering!  You can now set filters per
   column. This will render dropdowns of all of the possible values for
   your field. The slice has been updated with screenshot and usages
   instructions.

   On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:

 Just added: multiple grids per page is supported now!

Very useful. Thanks for your further explanations too.
-David

   --

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

  --
  Atenciosamente

  --
  =
  Alexandre Andrade
  Hipercenter.com



--

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




[web2py:37253] Re: ldap authentication stopped working: enter a valid email address

2009-12-15 Thread Fred
That IS_EMAIL() temporary validator is exactly what I *don't* want for
LDAP authentication.

--

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




[web2py:37254] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread mr.freeze
Fixed!

On Dec 15, 1:43 pm, mr.freeze nat...@freezable.com wrote:
 Looks like filters and paging aren't working together. I should have
 it fixed soon.

 On Dec 15, 1:32 pm, mr.freeze nat...@freezable.com wrote:

  If your datasource is not a join:
  grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
                                                         args=
  [request.args(0), self.tablenames[0], row['id']]))

  If it is a join:
  grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
                                                         args=
  [request.args(0), self.tablenames[0],
                                                               row
  [self.tablenames[0]]['id']]))

  On Dec 15, 1:10 pm, Alexandre Andrade alexandrema...@gmail.com
  wrote:

   I need to personalize edit link to a custom page, where I use 
   request.arg(0)

  http://localhost/default/custo/11

   but i need to know what form to use and the id of row. The link would be
   like:

  http://localhost/default/custo/11/custo_pessoal/12

   how personalize it in

   grid.edit_link = lambda row: ...

   ???

   Thanks in advance.

   2009/12/15 mr.freeze nat...@freezable.com

This just added: column filtering!  You can now set filters per
column. This will render dropdowns of all of the possible values for
your field. The slice has been updated with screenshot and usages
instructions.

On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
 On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:

  Just added: multiple grids per page is supported now!

 Very useful. Thanks for your further explanations too.
 -David

--

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

   --
   Atenciosamente

   --
   =
   Alexandre Andrade
   Hipercenter.com



--

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




Re: [web2py:37255] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread Alexandre Andrade
I had put a workaround in comments at
http://www.web2pyslices.com/main/slices/take_slice/39, and now I see you
updated it.

Thanks


2009/12/15 mr.freeze nat...@freezable.com

 Fixed!

 On Dec 15, 1:43 pm, mr.freeze nat...@freezable.com wrote:
  Looks like filters and paging aren't working together. I should have
  it fixed soon.
 
  On Dec 15, 1:32 pm, mr.freeze nat...@freezable.com wrote:
 
   If your datasource is not a join:
   grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
  args=
   [request.args(0), self.tablenames[0], row['id']]))
 
   If it is a join:
   grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
  args=
   [request.args(0), self.tablenames[0],
row
   [self.tablenames[0]]['id']]))
 
   On Dec 15, 1:10 pm, Alexandre Andrade alexandrema...@gmail.com
   wrote:
 
I need to personalize edit link to a custom page, where I use
 request.arg(0)
 
   http://localhost/default/custo/11
 
but i need to know what form to use and the id of row. The link would
 be
like:
 
   http://localhost/default/custo/11/custo_pessoal/12
 
how personalize it in
 
grid.edit_link = lambda row: ...
 
???
 
Thanks in advance.
 
2009/12/15 mr.freeze nat...@freezable.com
 
 This just added: column filtering!  You can now set filters per
 column. This will render dropdowns of all of the possible values
 for
 your field. The slice has been updated with screenshot and usages
 instructions.
 
 On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
  On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:
 
   Just added: multiple grids per page is supported now!
 
  Very useful. Thanks for your further explanations too.
  -David
 
 --
 
 You received this message because you are subscribed to the Google
 Groups  web2py-users group. To post to this group,
 sendemailtoweb...@googlegroups.com.  To unsubscribe from this group,
 send email 
 toweb2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
 .
 For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.
 
--
Atenciosamente
 
--
=
Alexandre Andrade
Hipercenter.com
 
 

 --

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





-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

--

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




[web2py:37256] Form element definition examples

2009-12-15 Thread waTR
Is there a definition of all possible arguments for form.element and
some examples somewhere?

I am mainly looking to use it with SQLForm and factory().
Specifically, I want to create a form with SQLForm  factory, and then
modify some of the elements to be things other than text boxes, i.e.
to change some to drop-downs with some choices, and others to radio
buttons, etc.

Is the above possible? And with what element argument?

--

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




Re: [web2py:37257] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread Alexandre Andrade
I get a error:


Error traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File gluon/restricted.py, line 173, in restricted
exec ccode in environment
  File /home/web2py/applications/convenios/controllers/default.py
https://www.hipercenter.com/admin/default/edit/convenios/controllers/default.py,
line 320, in module
  File gluon/globals.py, line 96, in lambda
self._caller = lambda f: f()
  File /home/web2py/applications/convenios/controllers/default.py
https://www.hipercenter.com/admin/default/edit/convenios/controllers/default.py,
line 137, in custo
grid_pessoal=grid_pessoal() )
  File applications/convenios/modules/webgrid.py, line 380, in __call__
_row = self.header(self.fields)
  File applications/convenios/modules/webgrid.py, line 262, in header
self.update_filters(vars,filters)
NameError: free variable 'filters' referenced before assignment in
enclosing scope



2009/12/15 Alexandre Andrade alexandrema...@gmail.com


 I had put a workaround in comments at
 http://www.web2pyslices.com/main/slices/take_slice/39, and now I see you
 updated it.

 Thanks


 2009/12/15 mr.freeze nat...@freezable.com

 Fixed!

 On Dec 15, 1:43 pm, mr.freeze nat...@freezable.com wrote:
  Looks like filters and paging aren't working together. I should have
  it fixed soon.
 
  On Dec 15, 1:32 pm, mr.freeze nat...@freezable.com wrote:
 
   If your datasource is not a join:
   grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
  args=
   [request.args(0), self.tablenames[0], row['id']]))
 
   If it is a join:
   grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
  args=
   [request.args(0), self.tablenames[0],
row
   [self.tablenames[0]]['id']]))
 
   On Dec 15, 1:10 pm, Alexandre Andrade alexandrema...@gmail.com
   wrote:
 
I need to personalize edit link to a custom page, where I use
 request.arg(0)
 
   http://localhost/default/custo/11
 
but i need to know what form to use and the id of row. The link
 would be
like:
 
   http://localhost/default/custo/11/custo_pessoal/12
 
how personalize it in
 
grid.edit_link = lambda row: ...
 
???
 
Thanks in advance.
 
2009/12/15 mr.freeze nat...@freezable.com
 
 This just added: column filtering!  You can now set filters per
 column. This will render dropdowns of all of the possible values
 for
 your field. The slice has been updated with screenshot and usages
 instructions.
 
 On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
  On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:
 
   Just added: multiple grids per page is supported now!
 
  Very useful. Thanks for your further explanations too.
  -David
 
 --
 
 You received this message because you are subscribed to the Google
 Groups  web2py-users group. To post to this group,
 sendemailtoweb...@googlegroups.com.  To unsubscribe from this group,
 send email 
 toweb2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
 .
 For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.
 
--
Atenciosamente
 
--
=
Alexandre Andrade
Hipercenter.com
 
 

 --

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





 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com




-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

--

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




[web2py:37259] Re: Translation issue

2009-12-15 Thread Yarko Tymciurak
On Dec 15, 8:56 am, Andrea Cappelli a.cappe...@gmail.com wrote:
 Hi List,
 I'm a web2py user since few months and now I'm dealing with 2 problems
 regarding translations

 1) With latest release (1.74.1) I get no sentence translated. I have 2
 files in languages/ (en.py and it.py) and some symlink (en-us.py, en-
 gb.py, it-it.py), but i receive always the text in italian (the
 language used as T argument)

If the string argument of T is Italian, then how I expect this to work
is this:

Translation is from some language, to some language.

In web2py case, there is only static translation, that is - the
languages/*.py files, so that all the logic has to decide is
What is the source language (the strings in the application)?
What is the client requested language (or acceptable lanugages), e.g.
http_accept_language?
If client_accept != source, then serve the appropriate string from the
first available languages/*.py file which matches one of the
http_accept_language

That is all.

In the past,  web2py would look for http_accept, and serve the first
languages/*.py file that was found, or NONE if none was found.

This was a BUG because (for example) if a client had an
accept_language sequence as ['en', 'it']   and there was no languages/
en.py,  but there was it.py, then Italian was ALWAYS served, EVEN when
the argument language to the T('This is an english source string')
was english.

The problem was that there was not concept of source language for the
application;  this was added, and the default of 'en' set.

Now, if you simply declare My T() strings are 'it'!  all will work
as it should.


 2) If I use the old 1.65.1 (rev 992) all seems to work properly, but I
 have another problem. I wrote a python script to completely wget all
 pages (production server doesn't have python, so i have to put on it
 only html/css/js) and always works if I have only one language. If I
 have both en.py and it.py strange behaviour appear. The most annoying
 thing is that the language file is corrupted by web2py, in it i can
 see a comment reporting that the file is utf8 and an open curly
 bracket ( '{' ).
 Seems that web2py opens the file but for some reason fail when write
 to it

Can you share your script?

- Yarko

 There is someone that has similar issues?

--

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




[web2py:37260] Re: new on web2pyslices.com: WebGrid

2009-12-15 Thread mr.freeze
My bad, please download again.

On Dec 15, 2:04 pm, Alexandre Andrade alexandrema...@gmail.com
wrote:
 I get a error:

 Error traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.

 Traceback (most recent call last):
   File gluon/restricted.py, line 173, in restricted
     exec ccode in environment
   File /home/web2py/applications/convenios/controllers/default.py
 https://www.hipercenter.com/admin/default/edit/convenios/controllers/...,
 line 320, in module
   File gluon/globals.py, line 96, in lambda
     self._caller = lambda f: f()
   File /home/web2py/applications/convenios/controllers/default.py
 https://www.hipercenter.com/admin/default/edit/convenios/controllers/...,
 line 137, in custo
     grid_pessoal=grid_pessoal() )
   File applications/convenios/modules/webgrid.py, line 380, in __call__
     _row = self.header(self.fields)
   File applications/convenios/modules/webgrid.py, line 262, in header
     self.update_filters(vars,filters)
 NameError: free variable 'filters' referenced before assignment in
 enclosing scope

 2009/12/15 Alexandre Andrade alexandrema...@gmail.com





  I had put a workaround in comments at
 http://www.web2pyslices.com/main/slices/take_slice/39, and now I see you
  updated it.

  Thanks

  2009/12/15 mr.freeze nat...@freezable.com

  Fixed!

  On Dec 15, 1:43 pm, mr.freeze nat...@freezable.com wrote:
   Looks like filters and paging aren't working together. I should have
   it fixed soon.

   On Dec 15, 1:32 pm, mr.freeze nat...@freezable.com wrote:

If your datasource is not a join:
grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
                                                       args=
[request.args(0), self.tablenames[0], row['id']]))

If it is a join:
grid.edit_link = lambda row: A('edit', _href=self.crud.url(f='custo',
                                                       args=
[request.args(0), self.tablenames[0],
                                                             row
[self.tablenames[0]]['id']]))

On Dec 15, 1:10 pm, Alexandre Andrade alexandrema...@gmail.com
wrote:

 I need to personalize edit link to a custom page, where I use
  request.arg(0)

http://localhost/default/custo/11

 but i need to know what form to use and the id of row. The link
  would be
 like:

http://localhost/default/custo/11/custo_pessoal/12

 how personalize it in

 grid.edit_link = lambda row: ...

 ???

 Thanks in advance.

 2009/12/15 mr.freeze nat...@freezable.com

  This just added: column filtering!  You can now set filters per
  column. This will render dropdowns of all of the possible values
  for
  your field. The slice has been updated with screenshot and usages
  instructions.

  On Dec 12, 7:32 am, villas villa...@gmail.com wrote:
   On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:

Just added: multiple grids per page is supported now!

   Very useful. Thanks for your further explanations too.
   -David

  --

  You received this message because you are subscribed to the Google
  Groups  web2py-users group. To post to this 
  group,sendemailtoweb...@googlegroups.com.  To unsubscribe from this 
  group, send email 
  toweb2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
   
  web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com

  .
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

  --

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

  --
  Atenciosamente

  --
  =
  Alexandre Andrade
  Hipercenter.com

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

--

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




[web2py:37261] Re: pyforum vulnerabilities?

2009-12-15 Thread Julio
Massimo,

I also received the email from a Vietnamese (or chinese, can't
remember) security firm that basically told me the exact same thing
as you are writing, they basically wanted me to sign an agreement
with them in order to not disclose the vulnerability otherwise they
would disclose to the appropriate parties [?], I basically asked
them to cut the BS and give me a proof of concept and received no
further response.

XML() (along with T()) is used on virtually every string exposed
publicly, and all mail sending is handled by its own (protected)
class.

I don't know how can a password be sent to the forum admin, since
password retrieval relies on the original user's email..

Don't get me wrong, I am not saying the app is bug-free but the fact
that they reference a problem by describing a totally different one
takes the credibility factor out of my plate..

Thanks!
Julio

On Dec 15, 10:17 am, mdipierro mdipie...@cs.depaul.edu wrote:
 There are a number of security advisory reports online about pyforum,
 some from reputable sources.

 They report two vulnerabilities:

 1) What they refer to as a backdoor but they describe as a different
 problem: an attacker can force pyforum to email a new password to the
 administrator (not to the attacker himself). If true this is not a
 major problem but it may be annoying for the administrator.

 2) There is a XSS vulnerability. If true, is major security issue but
 it would be trivial to fix using XML(...,sanitize=True).

 I have not looked at the source code.
 Somebody should look into this and fix it or respond to the security
 advisory.

 Massimo

--

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




[web2py:37262] Re: GAE mkdir error

2009-12-15 Thread Vidul Petrov
GAE does not allow write access to the file system.

On Dec 15, 2:59 am, Richard richar...@gmail.com wrote:
 I uploaded an app to GAE and it triggered an error from trying to
 create a missing directory:

 File /gluon/main.py, line 432, in wsgibase
     os.mkdir(path)
 AttributeError: 'module' object has no attribute 'mkdir'

 I have already run the app locally before uploading, so all the
 directories exist.
 I am using 1.74.1, and as a temporary solution am catching and
 ignoring the exception.

--

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




Re: [web2py:37263] Re: Excess whitespace in html

2009-12-15 Thread Jonathan Lundell


On Dec 15, 2009, at 12:08 PM, Alex Fanjul wrote:

 Hello Kbochert, it seems you found out a way to make cleaner output, do 
 you get it working automatically? (ie. with out manual action for output 
 clean process)
 I'm thinking in alway pass dictionaris throught filter function so 
 instead of return dict we'd return filter(dict) but I'm not sure if it 
 would be right.
 Could you give me the steps or snippet example to achieve this?
 
 Finally, did you find any disadventages doing this? errors, slower 
 speed, etc...

I think it might be most useful to filter the entire page content, after it's 
composed, but before it's delivered. Say a filter function, by default None, in 
response, that gets called just before delivering the page, if the content-type 
is appropriate.

 
 Thanks a lot,
 Alex F
 
 El 15/12/2009 17:13, kbochert escribió:
 Jonathon wrote:
 
 2x seems like an awful lot, since a newline is only one byte. Are you sure?
 
 The  output typically has multiple leading spaces on those blank
 lines, presumably driven by the indenting of the original html.
 
 DenesL wrote:
 
 Do you want you view or your final output to be legible and
 aesthetically pleasing according to some subjective human standard?.
 
 Absolutely!
 For instance,  I'm currently looking for a designer to style my site.
 The first thing I do is surf to their home page and look at its source
 code!
 If I'm evangelizing web2py to colleagues, clean output helps. (makes
 me prouder of my work, at least)
 
 
 I tried massimos' code snippet
 def filter(d):
 import re
 if isinstance(d,dict):
  return re.compile('\n\n').sub('\n',response.render(d))
 return d
 response._caller=filter
 
 It failed, generating pages with a single line of html function
 index at 0x01A04C70
   -- but --
 
 def filter(d):
 import re
 if isinstance(d,dict):
  return re.compile('\n\s\s+\n').sub('\n',response.render(d))
 return re.compile('\n\s\s+\n').sub('\n',response.render(d()))
 response._caller=filter
 
 worked !beautifully!  When I take care to write the template cleanly,
 the rendering is also clean.
 
 This makes a distinction between empty lines (with no characters), and
 blank lines (containing only whitespace chars).
 blank lines are removed, empty lines are not. (whitespace matters!)
 
 
 It would be nice if web2py could make this its default rendering
 behavior.
 
 Are there other issues thanpre  blocks?
 
 
 Karl
 
 
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 
 
 
 
 
 -- 
 Alejandro Fanjul Fdez.
 alex.fan...@gmail.com
 www.mhproject.org
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 
 

--

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




Re: [web2py:37264] Re: Translation issue

2009-12-15 Thread Andrea Cappelli
2009/12/15 Yarko Tymciurak resultsinsoftw...@gmail.com:

 If the string argument of T is Italian, then how I expect this to work
 is this: [.]  That is all.

This is clear, I have sentences in italian and i have 2 files

-- it.py
'Ciao Mondo':'Ciao Mondo'

-- en.py
'Ciao Mondo':'Hello World'

and in some view I have T('Ciao Mondo')

My hope is that I see 'Hello World' when  browser accept_language in
pointed on en, 'Ciao Mondo' if I request it and 'Ciao Mondo' (please
read this as the dict key and not as a translation) when no lang or
uknown lang is submitted

I'm wrong?


 In the past,  web2py would look for http_accept, and serve the first
 languages/*.py file that was found, or NONE if none was found.

 This was a BUG because (for example) if a client had an
 accept_language sequence as ['en', 'it']   and there was no languages/
 en.py,  but there was it.py, then Italian was ALWAYS served, EVEN when
 the argument language to the T('This is an english source string')
 was english.

Ok, this is definitely a bug :)


 The problem was that there was not concept of source language for the
 application;  this was added, and the default of 'en' set.

 Now, if you simply declare My T() strings are 'it'!  all will work
 as it should.


 2) If I use the old 1.65.1 (rev 992) all seems to work properly, but I
 have another problem. I wrote a python script to completely wget all
 pages (production server doesn't have python, so i have to put on it
 only html/css/js) and always works if I have only one language. If I
 have both en.py and it.py strange behaviour appear. The most annoying
 thing is that the language file is corrupted by web2py, in it i can
 see a comment reporting that the file is utf8 and an open curly
 bracket ( '{' ).
 Seems that web2py opens the file but for some reason fail when write
 to it

 Can you share your script?

Not at this moment (I hope soon).

Trying to summarize there were a list of url and a pool of thread that
simply get (using the command line tool wget) pages and write them to
disk

With the old version sometimes file it.py became corrupt with only '{'
in it. As I have wrote I think this was solved with the lock
introduced in newer version of gluon/langages.py

Thank you

--

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




Re: [web2py:37265] Re: Translation issue

2009-12-15 Thread Andrea Cappelli
2009/12/15 Yarko Tymciurak resultsinsoftw...@gmail.com:

 On Dec 15, 11:23 am, Andrea Cappelli a.cappe...@gmail.com wrote:
 Il giorno mar, 15/12/2009 alle 07.37 -0800, mdipierro ha scritto:

  We had a long discussion about this. We had a minor change of behavior
  that basically assumes the default language is English. We did not
  make such assumptions before. I opposed such change but apparently I
  was the only one and everybody else spoke for it. Now you have to be
  explicit about the fact that your language is Italian (somewhere
  before you use T):


 The solution was to be sure web2py had SOME DEFAULT definition for
 what the language of the strings within applications is (so that the
 correct translation texts would be selected).

Ok, this is clear

 You do not need to do this in every controller (although you _can_,
 unless you have a language course as the application, you probably do
 not _want_ to!)

The only problem is that setting T.current_language seems not work for
me, I need to call T.force(lang), where lang is recovered from request
and I don't know if request is available in models but I think it
doesn't


 This is a unfortunate naming of this variable - it is confusing...
 I should have named it T.app_language

OK

 In any case, you should - in model/db.py - simply declare what the
 default language of the source of the application is.

Ok, this is the right way

 I hope this helps.

Sure, I'll let you all know and I hope to share the script

Thanks

Bests,
Andrea

--

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




[web2py:37266] Re: pyforum vulnerabilities?

2009-12-15 Thread mdipierro
Thank you Julio.
This is what I wanted to hear. It would still be good to have the
forum audited by a few members of the group.

Somehow their behavior does not surprise me.

Massimo

On Dec 15, 2:47 pm, Julio ju...@techfuel.net wrote:
 Massimo,

 I also received the email from a Vietnamese (or chinese, can't
 remember) security firm that basically told me the exact same thing
 as you are writing, they basically wanted me to sign an agreement
 with them in order to not disclose the vulnerability otherwise they
 would disclose to the appropriate parties [?], I basically asked
 them to cut the BS and give me a proof of concept and received no
 further response.

 XML() (along with T()) is used on virtually every string exposed
 publicly, and all mail sending is handled by its own (protected)
 class.

 I don't know how can a password be sent to the forum admin, since
 password retrieval relies on the original user's email..

 Don't get me wrong, I am not saying the app is bug-free but the fact
 that they reference a problem by describing a totally different one
 takes the credibility factor out of my plate..

 Thanks!
 Julio

 On Dec 15, 10:17 am, mdipierro mdipie...@cs.depaul.edu wrote:

  There are a number of security advisory reports online about pyforum,
  some from reputable sources.

  They report two vulnerabilities:

  1) What they refer to as a backdoor but they describe as a different
  problem: an attacker can force pyforum to email a new password to the
  administrator (not to the attacker himself). If true this is not a
  major problem but it may be annoying for the administrator.

  2) There is a XSS vulnerability. If true, is major security issue but
  it would be trivial to fix using XML(...,sanitize=True).

  I have not looked at the source code.
  Somebody should look into this and fix it or respond to the security
  advisory.

  Massimo

--

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




[web2py:37267] Re: GAE mkdir error

2009-12-15 Thread mdipierro
yes but this folders should be created locally, then uploaded. Web2py
check for existance before trying to create them.

On Dec 15, 2:48 pm, Vidul Petrov vidul.r...@gmail.com wrote:
 GAE does not allow write access to the file system.

 On Dec 15, 2:59 am, Richard richar...@gmail.com wrote:

  I uploaded an app to GAE and it triggered an error from trying to
  create a missing directory:

  File /gluon/main.py, line 432, in wsgibase
      os.mkdir(path)
  AttributeError: 'module' object has no attribute 'mkdir'

  I have already run the app locally before uploading, so all the
  directories exist.
  I am using 1.74.1, and as a temporary solution am catching and
  ignoring the exception.

--

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




[web2py:37268] r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread Fran
In r1432 (Bzr)  earlier, GET vars are added to request.vars even on
POST as per the comments:
parse GET vars, even if POST

In r1433, this changes so that these are only available in
request.get_vars for POSTs.

Why this incompatible change?
Surely a POST can explicitly check just post_vars if desired...why
break compatibility?

F

--

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




[web2py:37269] Re: Using db in uploaded modules

2009-12-15 Thread Hillman
Thanks -

Passing db into the module works as I wanted it to.

On Dec 15, 11:45 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Is the module imported by web2py? If not you need to pass the db to
 thsoe functions/classes defined in the module that need to use it.

 Else you should probably run web2py -S app -M -R yourmodule.py

 On Dec 15, 12:28 pm, Hillman hillma...@gmail.com wrote:

  I have a module that I uploaded to an application, and I was wondering
  if there is a way that I can access my databases within the module. I
  imagine it is just a matter of importing the right things, but I don't
  know what all I need to import.



--

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




[web2py:37270] Re: GAE mkdir error

2009-12-15 Thread howesc
I had the same problem running the dev_appserver (the latest release
1.3.0).  it was trying to create:
 /web2py/applications/app_name/errors which existed in my file
system.  I wrapped the entire for loop in:
 if not request.env.web2py_runtime_gae:
and it works fine.

thanks,

christian

On Dec 15, 1:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 yes but this folders should be created locally, then uploaded. Web2py
 check for existance before trying to create them.

 On Dec 15, 2:48 pm, Vidul Petrov vidul.r...@gmail.com wrote:

 GAEdoes not allow write access to the file system.

  On Dec 15, 2:59 am, Richard richar...@gmail.com wrote:

   I uploaded an app toGAEand it triggered an error from trying to
   create a missing directory:

   File /gluon/main.py, line 432, in wsgibase
       os.mkdir(path)
   AttributeError: 'module' object has no attribute 'mkdir'

   I have already run the app locally before uploading, so all the
   directories exist.
   I am using 1.74.1, and as a temporary solution am catching and
   ignoring the exception.



--

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




[web2py:37271] Re: Form element definition examples

2009-12-15 Thread Mengu
yes, this is possible.

lets say you created a form like this: form = SQLFORM(db.post) and
your post have two fields title and body. the form will be like this:

title - input for title
body - textarea for body

you can make it like this:
form[0][1][1] = TD(INPUT(_type=text, _name=body, _size=50))

to replace body textarea with a body textbox.

i hope it's clear.

On Dec 15, 10:02 pm, waTR r...@devshell.org wrote:
 Is there a definition of all possible arguments for form.element and
 some examples somewhere?

 I am mainly looking to use it with SQLForm and factory().
 Specifically, I want to create a form with SQLForm  factory, and then
 modify some of the elements to be things other than text boxes, i.e.
 to change some to drop-downs with some choices, and others to radio
 buttons, etc.

 Is the above possible? And with what element argument?

--

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




[web2py:37272] Re: r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread mdipierro
This may be a bug. Which python version do you use? Both get_vars and
post_vars should be added to vars.
Can you provide an example to make sure I understand?

Massimo

On Dec 15, 3:35 pm, Fran francisb...@googlemail.com wrote:
 In r1432 (Bzr)  earlier, GET vars are added to request.vars even on
 POST as per the comments:
 parse GET vars, even if POST

 In r1433, this changes so that these are only available in
 request.get_vars for POSTs.

 Why this incompatible change?
 Surely a POST can explicitly check just post_vars if desired...why
 break compatibility?

 F

--

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




[web2py:37273] Re: Form element definition examples

2009-12-15 Thread mr.freeze
element and elements take any combination of args and keywords and
cycle through the form components looking for match(es)

form.element('input',_type='text')# grabs the first text input
form.elements('input',_type='text')# grabs all text inputs

form.elements('input','textarea') # grabs all inputs and textareas

On Dec 15, 2:02 pm, waTR r...@devshell.org wrote:
 Is there a definition of all possible arguments for form.element and
 some examples somewhere?

 I am mainly looking to use it with SQLForm and factory().
 Specifically, I want to create a form with SQLForm  factory, and then
 modify some of the elements to be things other than text boxes, i.e.
 to change some to drop-downs with some choices, and others to radio
 buttons, etc.

 Is the above possible? And with what element argument?

--

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




[web2py:37274] Re: pyforum vulnerabilities?

2009-12-15 Thread Richard
I'm curious, where did you find these reports?


On Dec 16, 5:17 am, mdipierro mdipie...@cs.depaul.edu wrote:
 There are a number of security advisory reports online about pyforum,
 some from reputable sources.

 They report two vulnerabilities:

 1) What they refer to as a backdoor but they describe as a different
 problem: an attacker can force pyforum to email a new password to the
 administrator (not to the attacker himself). If true this is not a
 major problem but it may be annoying for the administrator.

 2) There is a XSS vulnerability. If true, is major security issue but
 it would be trivial to fix using XML(...,sanitize=True).

 I have not looked at the source code.
 Somebody should look into this and fix it or respond to the security
 advisory.

 Massimo

--

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




[web2py:37275] Re: news blobstore on gae

2009-12-15 Thread Richard
keep in mind that currently it is only for applications that have
enabled billing.


On Dec 16, 2:43 am, mdipierro mdipie...@cs.depaul.edu wrote:
 This is a good time to be rewriting the DAL:

 http://googleappengine.blogspot.com/2009/12/app-engine-sdk-130-releas...

 We should take advantage of this.

--

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




[web2py:37276] Re: r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread Fran
On Dec 15, 10:11 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 This may be a bug.

That would better than a policy change :)
I tried seeing if line 295 should be
pvalue = pvalue + gvalue
instead of
value = pvalue + gvalue

but no joy

Which python version do you use?

2.5.4

 Both get_vars and post_vars should be added to vars.
 Can you provide an example to make sure I understand?

I use a ?format= to pass the representation in the REST Controller.
This was parsed out from request.vars but with r1433+ I needed to
parse out of request.get_vars otherwise it was missed  so default
representation was used.

Thanks for looking into it...I fixed the 1st known instance of where
this tripped me up, but there may be more  for other ppl too...

F

--

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




[web2py:37277] Re: r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread mdipierro
I need a concrete example of URL and what you find in vars, get_vars
and post_vars

This is because the code attempts to go around incompatibilities
between different python versions and does not behave in the same way
on all versions.

Massimo

On Dec 15, 4:19 pm, Fran francisb...@googlemail.com wrote:
 On Dec 15, 10:11 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  This may be a bug.

 That would better than a policy change :)
 I tried seeing if line 295 should be
 pvalue = pvalue + gvalue
 instead of
 value = pvalue + gvalue

 but no joy

 Which python version do you use?

 2.5.4

  Both get_vars and post_vars should be added to vars.
  Can you provide an example to make sure I understand?

 I use a ?format= to pass the representation in the REST Controller.
 This was parsed out from request.vars but with r1433+ I needed to
 parse out of request.get_vars otherwise it was missed  so default
 representation was used.

 Thanks for looking into it...I fixed the 1st known instance of where
 this tripped me up, but there may be more  for other ppl too...

 F

--

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




[web2py:37278] Re: GAE mkdir error

2009-12-15 Thread mdipierro
Did you run the app first locally without dev_appserver? That should
have created the missing folders. No?

On Dec 15, 4:06 pm, howesc how...@umich.edu wrote:
 I had the same problem running the dev_appserver (the latest release
 1.3.0).  it was trying to create:
  /web2py/applications/app_name/errors which existed in my file
 system.  I wrapped the entire for loop in:
  if not request.env.web2py_runtime_gae:
 and it works fine.

 thanks,

 christian

 On Dec 15, 1:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  yes but this folders should be created locally, then uploaded. Web2py
  check for existance before trying to create them.

  On Dec 15, 2:48 pm, Vidul Petrov vidul.r...@gmail.com wrote:

  GAEdoes not allow write access to the file system.

   On Dec 15, 2:59 am, Richard richar...@gmail.com wrote:

I uploaded an app toGAEand it triggered an error from trying to
create a missing directory:

File /gluon/main.py, line 432, in wsgibase
    os.mkdir(path)
AttributeError: 'module' object has no attribute 'mkdir'

I have already run the app locally before uploading, so all the
directories exist.
I am using 1.74.1, and as a temporary solution am catching and
ignoring the exception.

--

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




[web2py:37279] Re: GAE mkdir error

2009-12-15 Thread mdipierro
PS. Damn Mercurial!

On Dec 15, 4:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Did you run the app first locally without dev_appserver? That should
 have created the missing folders. No?

 On Dec 15, 4:06 pm, howesc how...@umich.edu wrote:

  I had the same problem running the dev_appserver (the latest release
  1.3.0).  it was trying to create:
   /web2py/applications/app_name/errors which existed in my file
  system.  I wrapped the entire for loop in:
   if not request.env.web2py_runtime_gae:
  and it works fine.

  thanks,

  christian

  On Dec 15, 1:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   yes but this folders should be created locally, then uploaded. Web2py
   check for existance before trying to create them.

   On Dec 15, 2:48 pm, Vidul Petrov vidul.r...@gmail.com wrote:

   GAEdoes not allow write access to the file system.

On Dec 15, 2:59 am, Richard richar...@gmail.com wrote:

 I uploaded an app toGAEand it triggered an error from trying to
 create a missing directory:

 File /gluon/main.py, line 432, in wsgibase
     os.mkdir(path)
 AttributeError: 'module' object has no attribute 'mkdir'

 I have already run the app locally before uploading, so all the
 directories exist.
 I am using 1.74.1, and as a temporary solution am catching and
 ignoring the exception.

--

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




[web2py:37280] Re: r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread Fran
On Dec 15, 10:40 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I need a concrete example of URL and what you find in vars, get_vars
 and post_vars

Model:
db.define_table('atable',
Field('afield'))

Controller:
def test():
form = crud.create(db.atable)
return dict(form=form)

URL:
http://127.0.0.1:8000/sahana/test/test?format=test
request.varsafield  wqrrwqe _formkey
880cbe69-a4fc-43cc-
a97d-724c215601ba   _formname   atable/None _next
request.get_varsformat  test
request.post_vars   afield  wqrrwqe _formkey
880cbe69-a4fc-43cc-
a97d-724c215601ba   _formname   atable/None _next

--

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




[web2py:37281] Re: GAE mkdir error

2009-12-15 Thread howesc
yes i did. :(  i was a bit surprised that it finds some folders, but
not the one named 'errors'.

On Dec 15, 2:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Did you run the app first locally without dev_appserver? That should
 have created the missing folders. No?

 On Dec 15, 4:06 pm, howesc how...@umich.edu wrote:

  I had the same problem running the dev_appserver (the latest release
  1.3.0).  it was trying to create:
   /web2py/applications/app_name/errors which existed in my file
  system.  I wrapped the entire for loop in:
   if not request.env.web2py_runtime_gae:
  and it works fine.

  thanks,

  christian

  On Dec 15, 1:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   yes but this folders should be created locally, then uploaded. Web2py
   check for existance before trying to create them.

   On Dec 15, 2:48 pm, Vidul Petrov vidul.r...@gmail.com wrote:

   GAEdoes not allow write access to the file system.

On Dec 15, 2:59 am, Richard richar...@gmail.com wrote:

 I uploaded an app toGAEand it triggered an error from trying to
 create a missing directory:

 File /gluon/main.py, line 432, in wsgibase
     os.mkdir(path)
 AttributeError: 'module' object has no attribute 'mkdir'

 I have already run the app locally before uploading, so all the
 directories exist.
 I am using 1.74.1, and as a temporary solution am catching and
 ignoring the exception.



--

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




[web2py:37282] Re: r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread mdipierro
Definitively a bug. Will fix it tonight.

Massimo

On Dec 15, 4:52 pm, Fran francisb...@googlemail.com wrote:
 On Dec 15, 10:40 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I need a concrete example of URL and what you find in vars, get_vars
  and post_vars

 Model:
 db.define_table('atable',
                 Field('afield'))

 Controller:
 def test():
     form = crud.create(db.atable)
     return dict(form=form)

 URL:http://127.0.0.1:8000/sahana/test/test?format=test
 request.vars    afield          wqrrwqe         _formkey        
 880cbe69-a4fc-43cc-
 a97d-724c215601ba       _formname       atable/None     _next
 request.get_vars        format  test
 request.post_vars       afield  wqrrwqe         _formkey        
 880cbe69-a4fc-43cc-
 a97d-724c215601ba       _formname       atable/None     _next

--

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




Re: [web2py:37283] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread Thadeus Burgess
I still do not see how field sets and legends could be determined by a
SMARTFORM using the current way web2py HELPERS work.

If you look at ruby on rails, this is why their forms require you to
explicitly define your forms.

Django has sort of what I would like, however lacks fieldsets.
django's form.as_p, form.as_ul, form.as_table, however for more
advanced functionality, django forms provide a similar custom
interface to the widgets.

A perfect form solution would actually be a mixture of both, we could
have the same as_p, as_ul, as_table. We could have one class
(SmartForm) which just defines the widgets, performs the validation,
and sets error messages. This would basically be a class that only
provides the same interfaces as SQLFORM.custom. Now with a SmartForm
class, you create a (FormRenderer) class that will take a SmartForm as
an argument (or SmartForm could take a renderer as an argument), and
render the form into HTML.

class AsPRenderer(FormRenderer):
class AsULRenderer(FormRenderer):
class AsTableRenderer(FormRenderer):

We're still left with the difficulty of fieldsets. How do we know what
fields break up into which fieldsets ? Passing a list that represents
the forms structure is the most logical way I can think of doing this
(refer to http://pastebin.com/m764d7a39 for an example... note the
matter list) For this there would need to be a class
CustomRenderer(FormRenderer) that takes said list as an argument.
(again my first question, I do not know how this could be worked with
web2py helpers)

How does this sound?

-Thadeus





On Tue, Dec 15, 2009 at 9:09 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 There is no reason to make SQLFORM more complex than it is. Why not
 move some of the SQLFORM logic into a new object SMARTFORM(?) and
 behaves like FORM but accepts Fields as helpers and processes them
 like SQLFORM? parhaps SQLFORM could be derived from such a beast.

 Massimo

 On Dec 15, 6:06 am, villas villa...@gmail.com wrote:
 @Thadeus
 Thanks for raising this topic.  Tables don't seem correct for laying
 out forms any more.  So,  should we assume that we're all heading in
 the direction of fieldsets?  Surely fieldsets should eventually be the
 default.

 Maybe one way forward to is introduce a new option:
 renderfieldset=False.  If true we can get a fieldset and drag our
 forms into the next generation!

 -David

 --

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




--

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




[web2py:37284] Re: Excess whitespace in html

2009-12-15 Thread kbochert
def filter(d):
import re
if isinstance(d,dict):
 return re.compile('\n\s\s+\n').sub('\n',response.render(d))
return re.compile('\n\s\s+\n').sub('\n',response.render(d()))
response._caller=filter

Just place the snippet above in your controller code or in your model
code. If in the controller, it filters the output of that controller.
If in the model code, it filters the entire app.

I have seen no errors, and the speed difference should be vanishingly
small.
The code output has a hand-crafted appearance, at least for views
written with my style.

karl

On Dec 15, 12:55 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 15, 2009, at 12:08 PM, Alex Fanjul wrote:

  Hello Kbochert, it seems you found out a way to make cleaner output, do
  you get it working automatically? (ie. with out manual action for output
  clean process)
  I'm thinking in alway pass dictionaris throught filter function so
  instead of return dict we'd return filter(dict) but I'm not sure if it
  would be right.
  Could you give me the steps or snippet example to achieve this?

  Finally, did you find any disadventages doing this? errors, slower
  speed, etc...

 I think it might be most useful to filter the entire page content, after it's 
 composed, but before it's delivered. Say a filter function, by default None, 
 in response, that gets called just before delivering the page, if the 
 content-type is appropriate.



  Thanks a lot,
  Alex F


--

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




[web2py:37285] Re: news blobstore on gae

2009-12-15 Thread mdipierro
It will be optional. Anyway, it will not happen tonight (I think).

On Dec 15, 4:18 pm, Richard richar...@gmail.com wrote:
 keep in mind that currently it is only for applications that have
 enabled billing.

 On Dec 16, 2:43 am, mdipierro mdipie...@cs.depaul.edu wrote:

  This is a good time to be rewriting the DAL:

 http://googleappengine.blogspot.com/2009/12/app-engine-sdk-130-releas...

  We should take advantage of this.

--

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




[web2py:37286] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread mdipierro
No. I django's form.as_p, form.as_ul, form.as_table are not an option
for web2py. Each of them is a specific solution. I think we are
looking for a general solution instead.

I think this takes two steps:

order 0) SMARTFORM = FORM
order 1) Fields get an .xml() attributes that serializes them using
the widget
order 2) move some of the SQLHTML logic into SMARTFORM

at that point SQLFORM is just an instance of a SMARTFORM (perhaps the
default SMARTFORM).

On Dec 15, 5:16 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 I still do not see how field sets and legends could be determined by a
 SMARTFORM using the current way web2py HELPERS work.

 If you look at ruby on rails, this is why their forms require you to
 explicitly define your forms.

 Django has sort of what I would like, however lacks fieldsets.
 django's form.as_p, form.as_ul, form.as_table, however for more
 advanced functionality, django forms provide a similar custom
 interface to the widgets.

 A perfect form solution would actually be a mixture of both, we could
 have the same as_p, as_ul, as_table. We could have one class
 (SmartForm) which just defines the widgets, performs the validation,
 and sets error messages. This would basically be a class that only
 provides the same interfaces as SQLFORM.custom. Now with a SmartForm
 class, you create a (FormRenderer) class that will take a SmartForm as
 an argument (or SmartForm could take a renderer as an argument), and
 render the form into HTML.

 class AsPRenderer(FormRenderer):
 class AsULRenderer(FormRenderer):
 class AsTableRenderer(FormRenderer):

 We're still left with the difficulty of fieldsets. How do we know what
 fields break up into which fieldsets ? Passing a list that represents
 the forms structure is the most logical way I can think of doing this
 (refer tohttp://pastebin.com/m764d7a39for an example... note the
 matter list) For this there would need to be a class
 CustomRenderer(FormRenderer) that takes said list as an argument.
 (again my first question, I do not know how this could be worked with
 web2py helpers)

 How does this sound?

 -Thadeus

 On Tue, Dec 15, 2009 at 9:09 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  There is no reason to make SQLFORM more complex than it is. Why not
  move some of the SQLFORM logic into a new object SMARTFORM(?) and
  behaves like FORM but accepts Fields as helpers and processes them
  like SQLFORM? parhaps SQLFORM could be derived from such a beast.

  Massimo

  On Dec 15, 6:06 am, villas villa...@gmail.com wrote:
  @Thadeus
  Thanks for raising this topic.  Tables don't seem correct for laying
  out forms any more.  So,  should we assume that we're all heading in
  the direction of fieldsets?  Surely fieldsets should eventually be the
  default.

  Maybe one way forward to is introduce a new option:
  renderfieldset=False.  If true we can get a fieldset and drag our
  forms into the next generation!

  -David

  --

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

--

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




[web2py:37287] Re: Excess whitespace in html

2009-12-15 Thread mdipierro
You may also want to look into scripts/cleanhtml.py and scripts/
cleancss.py. The only problem is that it breaks flash.

On Dec 15, 5:16 pm, kbochert kboch...@copper.net wrote:
 def filter(d):
     import re
     if isinstance(d,dict):
          return re.compile('\n\s\s+\n').sub('\n',response.render(d))
     return re.compile('\n\s\s+\n').sub('\n',response.render(d()))
 response._caller=filter

 Just place the snippet above in your controller code or in your model
 code. If in the controller, it filters the output of that controller.
 If in the model code, it filters the entire app.

 I have seen no errors, and the speed difference should be vanishingly
 small.
 The code output has a hand-crafted appearance, at least for views
 written with my style.

 karl

 On Dec 15, 12:55 pm, Jonathan Lundell jlund...@pobox.com wrote:

  On Dec 15, 2009, at 12:08 PM, Alex Fanjul wrote:

   Hello Kbochert, it seems you found out a way to make cleaner output, do
   you get it working automatically? (ie. with out manual action for output
   clean process)
   I'm thinking in alway pass dictionaris throught filter function so
   instead of return dict we'd return filter(dict) but I'm not sure if it
   would be right.
   Could you give me the steps or snippet example to achieve this?

   Finally, did you find any disadventages doing this? errors, slower
   speed, etc...

  I think it might be most useful to filter the entire page content, after 
  it's composed, but before it's delivered. Say a filter function, by default 
  None, in response, that gets called just before delivering the page, if the 
  content-type is appropriate.

   Thanks a lot,
   Alex F

--

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




Re: [web2py:37288] Re: Excess whitespace in html

2009-12-15 Thread Thadeus Burgess
It messes up my pre tags.

However this helps in cleaning up bad html generated from WYSIWYG editors.

-Thadeus





On Tue, Dec 15, 2009 at 5:16 PM, kbochert kboch...@copper.net wrote:
 def filter(d):
    import re
    if isinstance(d,dict):
         return re.compile('\n\s\s+\n').sub('\n',response.render(d))
    return re.compile('\n\s\s+\n').sub('\n',response.render(d()))
 response._caller=filter

 Just place the snippet above in your controller code or in your model
 code. If in the controller, it filters the output of that controller.
 If in the model code, it filters the entire app.

 I have seen no errors, and the speed difference should be vanishingly
 small.
 The code output has a hand-crafted appearance, at least for views
 written with my style.

 karl

 On Dec 15, 12:55 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 15, 2009, at 12:08 PM, Alex Fanjul wrote:

  Hello Kbochert, it seems you found out a way to make cleaner output, do
  you get it working automatically? (ie. with out manual action for output
  clean process)
  I'm thinking in alway pass dictionaris throught filter function so
  instead of return dict we'd return filter(dict) but I'm not sure if it
  would be right.
  Could you give me the steps or snippet example to achieve this?

  Finally, did you find any disadventages doing this? errors, slower
  speed, etc...

 I think it might be most useful to filter the entire page content, after 
 it's composed, but before it's delivered. Say a filter function, by default 
 None, in response, that gets called just before delivering the page, if the 
 content-type is appropriate.



  Thanks a lot,
  Alex F


 --

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




--

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




Re: [web2py:37289] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread Thadeus Burgess
I wouldn't be so quick to dismiss as_p as_ul and as_table. As they
offer pre-defined templates.

Also, I am quickly playing aroudn with your suggestion. I added
.forform() (that just returns self.widget(self, self.default) to field
objects, and I am using FORM.

The problem with this approach is it still requires the developer to
declare simple things, such as labels and submit buttons...

The following actually renders perfectly, and validates, however,
requires the developer to define labels, submit buttons and such.

form = FORM(
FIELDSET(LEGEND(Personal Information),
P(db.test.first_name.forform()),
P(db.test.last_name.forform()),
),
FIELDSET(LEGEND(Login Information),
P(db.test.username.forform()),
P(db.test.password.forform()),
),
FIELDSET(
INPUT(_type=submit, _value=submit),
)
)

Is this what you ment by a generic solution?

-Thadeus





On Tue, Dec 15, 2009 at 5:22 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 No. I django's form.as_p, form.as_ul, form.as_table are not an option
 for web2py. Each of them is a specific solution. I think we are
 looking for a general solution instead.

 I think this takes two steps:

 order 0) SMARTFORM = FORM
 order 1) Fields get an .xml() attributes that serializes them using
 the widget
 order 2) move some of the SQLHTML logic into SMARTFORM

 at that point SQLFORM is just an instance of a SMARTFORM (perhaps the
 default SMARTFORM).

 On Dec 15, 5:16 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 I still do not see how field sets and legends could be determined by a
 SMARTFORM using the current way web2py HELPERS work.

 If you look at ruby on rails, this is why their forms require you to
 explicitly define your forms.

 Django has sort of what I would like, however lacks fieldsets.
 django's form.as_p, form.as_ul, form.as_table, however for more
 advanced functionality, django forms provide a similar custom
 interface to the widgets.

 A perfect form solution would actually be a mixture of both, we could
 have the same as_p, as_ul, as_table. We could have one class
 (SmartForm) which just defines the widgets, performs the validation,
 and sets error messages. This would basically be a class that only
 provides the same interfaces as SQLFORM.custom. Now with a SmartForm
 class, you create a (FormRenderer) class that will take a SmartForm as
 an argument (or SmartForm could take a renderer as an argument), and
 render the form into HTML.

 class AsPRenderer(FormRenderer):
 class AsULRenderer(FormRenderer):
 class AsTableRenderer(FormRenderer):

 We're still left with the difficulty of fieldsets. How do we know what
 fields break up into which fieldsets ? Passing a list that represents
 the forms structure is the most logical way I can think of doing this
 (refer tohttp://pastebin.com/m764d7a39for an example... note the
 matter list) For this there would need to be a class
 CustomRenderer(FormRenderer) that takes said list as an argument.
 (again my first question, I do not know how this could be worked with
 web2py helpers)

 How does this sound?

 -Thadeus

 On Tue, Dec 15, 2009 at 9:09 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  There is no reason to make SQLFORM more complex than it is. Why not
  move some of the SQLFORM logic into a new object SMARTFORM(?) and
  behaves like FORM but accepts Fields as helpers and processes them
  like SQLFORM? parhaps SQLFORM could be derived from such a beast.

  Massimo

  On Dec 15, 6:06 am, villas villa...@gmail.com wrote:
  @Thadeus
  Thanks for raising this topic.  Tables don't seem correct for laying
  out forms any more.  So,  should we assume that we're all heading in
  the direction of fieldsets?  Surely fieldsets should eventually be the
  default.

  Maybe one way forward to is introduce a new option:
  renderfieldset=False.  If true we can get a fieldset and drag our
  forms into the next generation!

  -David

  --

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

 --

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




--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 

Re: [web2py:37290] New features not documented in Book 2nd edition

2009-12-15 Thread Thadeus Burgess
customizable csv has been in the dev since 1.73.1 but didn't actually
make it into stable until 1.74.1, just an fyi. ( ran into this issue
on my dev server, trying to use 1.73.1 had to revert to dev for the
time being)

-Thadeus





On Mon, Dec 14, 2009 at 10:40 PM, DenesL denes1...@yahoo.ca wrote:
 1.74.1

--

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




Re: [web2py:37291] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread Thadeus Burgess
The real problem is the cohesion between Models and Views within the
internal aspects of web2py. SQLFORM is way too cohesive between
validation and rendering. In my
opinion, this is why I suggested separate classes, one for the form
model, and another for the form rendering(view).

You solution, though works, creates an even bigger mess, since view
code would then also, be located in sql.py.

-Thadeus





On Tue, Dec 15, 2009 at 5:52 PM, Thadeus Burgess thade...@thadeusb.com wrote:
 I wouldn't be so quick to dismiss as_p as_ul and as_table. As they
 offer pre-defined templates.

 Also, I am quickly playing aroudn with your suggestion. I added
 .forform() (that just returns self.widget(self, self.default) to field
 objects, and I am using FORM.

 The problem with this approach is it still requires the developer to
 declare simple things, such as labels and submit buttons...

 The following actually renders perfectly, and validates, however,
 requires the developer to define labels, submit buttons and such.

 form = FORM(
        FIELDSET(LEGEND(Personal Information),
            P(db.test.first_name.forform()),
            P(db.test.last_name.forform()),
        ),
        FIELDSET(LEGEND(Login Information),
            P(db.test.username.forform()),
            P(db.test.password.forform()),
        ),
        FIELDSET(
            INPUT(_type=submit, _value=submit),
        )
    )

 Is this what you ment by a generic solution?

 -Thadeus





 On Tue, Dec 15, 2009 at 5:22 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 No. I django's form.as_p, form.as_ul, form.as_table are not an option
 for web2py. Each of them is a specific solution. I think we are
 looking for a general solution instead.

 I think this takes two steps:

 order 0) SMARTFORM = FORM
 order 1) Fields get an .xml() attributes that serializes them using
 the widget
 order 2) move some of the SQLHTML logic into SMARTFORM

 at that point SQLFORM is just an instance of a SMARTFORM (perhaps the
 default SMARTFORM).

 On Dec 15, 5:16 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 I still do not see how field sets and legends could be determined by a
 SMARTFORM using the current way web2py HELPERS work.

 If you look at ruby on rails, this is why their forms require you to
 explicitly define your forms.

 Django has sort of what I would like, however lacks fieldsets.
 django's form.as_p, form.as_ul, form.as_table, however for more
 advanced functionality, django forms provide a similar custom
 interface to the widgets.

 A perfect form solution would actually be a mixture of both, we could
 have the same as_p, as_ul, as_table. We could have one class
 (SmartForm) which just defines the widgets, performs the validation,
 and sets error messages. This would basically be a class that only
 provides the same interfaces as SQLFORM.custom. Now with a SmartForm
 class, you create a (FormRenderer) class that will take a SmartForm as
 an argument (or SmartForm could take a renderer as an argument), and
 render the form into HTML.

 class AsPRenderer(FormRenderer):
 class AsULRenderer(FormRenderer):
 class AsTableRenderer(FormRenderer):

 We're still left with the difficulty of fieldsets. How do we know what
 fields break up into which fieldsets ? Passing a list that represents
 the forms structure is the most logical way I can think of doing this
 (refer tohttp://pastebin.com/m764d7a39for an example... note the
 matter list) For this there would need to be a class
 CustomRenderer(FormRenderer) that takes said list as an argument.
 (again my first question, I do not know how this could be worked with
 web2py helpers)

 How does this sound?

 -Thadeus

 On Tue, Dec 15, 2009 at 9:09 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  There is no reason to make SQLFORM more complex than it is. Why not
  move some of the SQLFORM logic into a new object SMARTFORM(?) and
  behaves like FORM but accepts Fields as helpers and processes them
  like SQLFORM? parhaps SQLFORM could be derived from such a beast.

  Massimo

  On Dec 15, 6:06 am, villas villa...@gmail.com wrote:
  @Thadeus
  Thanks for raising this topic.  Tables don't seem correct for laying
  out forms any more.  So,  should we assume that we're all heading in
  the direction of fieldsets?  Surely fieldsets should eventually be the
  default.

  Maybe one way forward to is introduce a new option:
  renderfieldset=False.  If true we can get a fieldset and drag our
  forms into the next generation!

  -David

  --

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

 --

 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to 

[web2py:37292] Re: Excess whitespace in html

2009-12-15 Thread kbochert

On Dec 15, 3:24 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 It messes up my pre tags.

 However this helps in cleaning up bad html generated from WYSIWYG editors.

 -Thadeus


Works fine for my pre's. Just have to keep in mind the difference
between
pre
abc


def
/pre

which works as expected, and:

pre
abc


def
/pre

which doesn't.
Blank lines and empty lines are different!

Karl

--

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




Re: [web2py:37293] Re: Excess whitespace in html

2009-12-15 Thread Thadeus Burgess
My pre tags are generated by a WYSIWYG editor. It would be highly
inconvenient to edit the source it generates, just for pre tags to render
correctly

-Thadeus





On Tue, Dec 15, 2009 at 6:10 PM, kbochert kboch...@copper.net wrote:

 On Dec 15, 3:24 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 It messes up my pre tags.

 However this helps in cleaning up bad html generated from WYSIWYG
editors.

 -Thadeus


 Works fine for my pre's. Just have to keep in mind the difference
 between
 pre
abc


def
 /pre

 which works as expected, and:

 pre
abc


def
 /pre

 which doesn't.
 Blank lines and empty lines are different!

 Karl

 --

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




--

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




[web2py:37294] Re: Excess whitespace in html

2009-12-15 Thread kbochert


On Dec 15, 3:23 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You may also want to look into scripts/cleanhtml.py and scripts/
 cleancss.py. The only problem is that it breaks flash.


So flash passes through the renderer, AND is sensitive to blank
lines ?!

And people complain about Python being indentation sensitive :-)



karl

--

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




[web2py:37295] Auth-Login : Backward compatibility with the new release 1.74.1

2009-12-15 Thread Yannick

This is a follow up of this thread:
http://groups.google.com/group/web2py/browse_thread/thread/f6899f258368382f/761a94c588521b8c#761a94c588521b8c

Basically now when I migrate my application with this new release and
trying to login an user with a fake password I'm expecting to have a
feedback message (error) from the session... But instead there is a
server error here is the ticket that is generated:

Traceback (most recent call last):
  File /Users/OnemeWs/App Server/web2py/gluon/restricted.py, line
173, in restricted
exec ccode in environment
  File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
controllers/default.py, line 171, in module



  File /Users/OnemeWs/App Server/web2py/gluon/globals.py, line 96,
in lambda
self._caller = lambda f: f()
  File /Users/OnemeWs/App Server/web2py/applications/AppDemo/
controllers/default.py, line 134, in login
return dict(loginform = auth.login())
  File /Users/OnemeWs/App Server/web2py/gluon/tools.py, line 980, in
login
onvalidation=onvalidation):
  File /Users/OnemeWs/App Server/web2py/gluon/sqlhtml.py, line 771,
in accepts
onvalidation,
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1267, in
accepts
status = self._traverse(status)
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 456, in
_traverse
newstatus = self._validate()
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1074, in
_validate
(value, errors) = validator(value)
  File /Users/OnemeWs/App Server/web2py/gluon/validators.py, line
728, in __call__
if (not self.banned or not self.banned.match(domain)) \
AttributeError: 'lazyT' object has no attribute 'match'




Does anyone notice this issue in their application after they migrate
to the new release ?

Thanks,
Cheers,
Yannick P.

--

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




[web2py:37297] Re: Fail login doesn't return an errorm msg

2009-12-15 Thread Yannick
Hmmm Think there is an issue with this release... Please take a look
to the ticket generated after a user tried to login using a fake
password:




Traceback (most recent call last):
  File /Users/OnemeWs/App Server/web2py/gluon/restricted.py, line
173, in restricted
exec ccode in environment
  File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
controllers/default.py, line 171, in module

  File /Users/OnemeWs/App Server/web2py/gluon/globals.py, line 96,
in lambda
self._caller = lambda f: f()
  File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
controllers/default.py, line 134, in login
return dict(loginform = auth.login())
  File /Users/OnemeWs/App Server/web2py/gluon/tools.py, line 980, in
login
onvalidation=onvalidation):
  File /Users/OnemeWs/App Server/web2py/gluon/sqlhtml.py, line 771,
in accepts
onvalidation,
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1267, in
accepts
status = self._traverse(status)
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 456, in
_traverse
newstatus = self._validate()
  File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1074, in
_validate
(value, errors) = validator(value)
  File /Users/OnemeWs/App Server/web2py/gluon/validators.py, line
728, in __call__
if (not self.banned or not self.banned.match(domain)) \
AttributeError: 'lazyT' object has no attribute 'match'





Anyway idea ?

Yannick P.


On Dec 14, 11:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I do not know. Glad it is fixed anyway.

 On Dec 14, 9:19 pm, Yannick ytchatch...@gmail.com wrote:

  Hello Massimo,
  Thanks I just test the new release and realized that the double
  redirect seem to be fixed on the Auth - Login I just wonder what
  was the root of the issue I got in the previous release...

  Thanks

  On Dec 12, 12:31 pm, Yannick ytchatch...@gmail.com wrote:

   Hello Massimo, thanks for the note...
   i did follow your instructions which was :
   1) I put this in the view {{=loginform}}
   2) I print request.function and request.vars from the model
   And here is what i see:
   login
   Storage {'email': 'sdfsdf...@efsdf.cfd', '_formkey':
   '440a019c-1479-4b0d-8e86-b27c0496dd7a', 'password': '12w12123',
   '_formname': 'login', '_next': ''}
   login
   Storage {}

   It looks like there is a double redirect...

   I did create a small brand new application just to test the login with
   Auth using the web2py admin console ( Just to double check that is not
   my code which cause this) and I have the same result...

   I'll send you the code that I used to test it... I really don't know
   why that happen, I think it use to work in the pass...

   Thanks for your help...

   Cheers,
   Yannick P.

   On Dec 11, 9:59 am, mdipierro mdipie...@cs.depaul.edu wrote:

For debugging purposes

1) try replace everything in the view with {{=loginform}}

2) try print request.function, request.vars

what do you see?

Feel free to send me your code and I will take a look.

massimo

On Dec 11, 8:47 am, Yannick ytchatch...@gmail.com wrote:

 Yes I did comment this out auth.settings.login_next=URL(r=request,
 f='profile') 
 but still same old, the double redirect is still there... I really
 wonder what trigger that double redirection... there is nothing extra
 I'm doing here, I fulling using Auth API... Hmmm...

 On Dec 11, 9:33 am, Wes James compte...@gmail.com wrote:

  On Thu, Dec 10, 2009 at 8:09 PM, Yannick ytchatch...@gmail.com 
  wrote:
   Hello thanks for the note...

   I did add print request.function
   and Yes there is a double redirection because the output print the
   function login twice :
   login
   login

   I wonder how to fix this double redirection here is one of the 
   setting
   I have in my controller:
   auth.settings.login_next=URL(r=request, f='profile')

  comment this out just to see what happens...

  or use wingide and see where it goes.

   Do you have any idea... I'll keep debugging...

   On Dec 9, 11:20 pm, mdipierro mdipie...@cs.depaul.edu wrote:
   Add a

   print request.function

   to your model and check if there is a double redirect.
   The other possibility is that 

[web2py:37298] Dynamic CSS

2009-12-15 Thread kbochert
Just a thought---
Is it possible to serve a css file through the template system?

It might be very useful to be able to use css like:

{{ # define the colors }}
{{primary_color = 0xff3366}}

body {
color: {{=primary_color}} ;

background-color: {{= response.users_background}} ;
...
}


Karl




--

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




[web2py:37300] Re: Dynamic CSS

2009-12-15 Thread Mengu
karl,

what makes you think that's not possible? :)

On Dec 16, 2:38 am, kbochert kboch...@copper.net wrote:
 Just a thought---
 Is it possible to serve a css file through the template system?

 It might be very useful to be able to use css like:

 {{ # define the colors }}
 {{primary_color = 0xff3366}}

 body {
     color: {{=primary_color}} ;

     background-color: {{= response.users_background}} ;
     ...

 }

 Karl

--

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




Re: [web2py:37301] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread Thadeus Burgess
This does allow for custom form design, as web2py could never know what a
developer intends without him/her explicitly declaring it so.

I do think that .as_p, as_table..etc should be considered as a default form
view that could be a one liner call. Massimo you say we need a generic
solution, but we also need specific solutions that give some options but
still do some heavy lifting of the basic form generation.

Think of this, if a separate class for form rendering is created, custom
form rendering classes for any situation would be quite easy, especially if
they interface with an object that has already created say just the
widgets it would be exactly like sqlform.custom, but external from the
view. With this, its just a matter of a defining a different renderer for
your app if you need something custom Just like how the DAL is being
redesigned to be encapsulation and polymorphism. This is one of those places
that could greatly benefit from polymorphism.

some sample code for idea.
class FormRenderer():
   def __init__(form):
  ...
   def __call__():
  return TABLE(
   for field in self.form.fields:
TR(
TD(LABEL(field.label+:)),
TD(field.widget),
TD(field.comment),
_id = '%s__row'
),
   pass
TR(
INPUT(_type=submit, _value=submit),
),
),

class PRenderer(FormRenderer):
   def __init__(form):
   ...
   def __call__():
   return FORM(
   for field in self.form.fields
P(
LABEL(field.label+:),
field.widget,
field.comment,
),

-Thadeus




On Tue, Dec 15, 2009 at 6:09 PM, Thadeus Burgess thade...@thadeusb.comwrote:

 The real problem is the cohesion between Models and Views within the
 internal aspects of web2py. SQLFORM is way too cohesive between
 validation and rendering. In my
 opinion, this is why I suggested separate classes, one for the form
 model, and another for the form rendering(view).

 You solution, though works, creates an even bigger mess, since view
 code would then also, be located in sql.py.

 -Thadeus





 On Tue, Dec 15, 2009 at 5:52 PM, Thadeus Burgess thade...@thadeusb.com
 wrote:
  I wouldn't be so quick to dismiss as_p as_ul and as_table. As they
  offer pre-defined templates.
 
  Also, I am quickly playing aroudn with your suggestion. I added
  .forform() (that just returns self.widget(self, self.default) to field
  objects, and I am using FORM.
 
  The problem with this approach is it still requires the developer to
  declare simple things, such as labels and submit buttons...
 
  The following actually renders perfectly, and validates, however,
  requires the developer to define labels, submit buttons and such.
 
  form = FORM(
 FIELDSET(LEGEND(Personal Information),
 P(db.test.first_name.forform()),
 P(db.test.last_name.forform()),
 ),
 FIELDSET(LEGEND(Login Information),
 P(db.test.username.forform()),
 P(db.test.password.forform()),
 ),
 FIELDSET(
 INPUT(_type=submit, _value=submit),
 )
 )
 
  Is this what you ment by a generic solution?
 
  -Thadeus
 
 
 
 
 
  On Tue, Dec 15, 2009 at 5:22 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
  No. I django's form.as_p, form.as_ul, form.as_table are not an option
  for web2py. Each of them is a specific solution. I think we are
  looking for a general solution instead.
 
  I think this takes two steps:
 
  order 0) SMARTFORM = FORM
  order 1) Fields get an .xml() attributes that serializes them using
  the widget
  order 2) move some of the SQLHTML logic into SMARTFORM
 
  at that point SQLFORM is just an instance of a SMARTFORM (perhaps the
  default SMARTFORM).
 
  On Dec 15, 5:16 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  I still do not see how field sets and legends could be determined by a
  SMARTFORM using the current way web2py HELPERS work.
 
  If you look at ruby on rails, this is why their forms require you to
  explicitly define your forms.
 
  Django has sort of what I would like, however lacks fieldsets.
  django's form.as_p, form.as_ul, form.as_table, however for more
  advanced functionality, django forms provide a similar custom
  interface to the widgets.
 
  A perfect form solution would actually be a mixture of both, we could
  have the same as_p, as_ul, as_table. We could have one class
  (SmartForm) which just defines the widgets, performs the validation,
  and sets error messages. This would basically be a class that only
  provides the same interfaces as SQLFORM.custom. Now with a SmartForm
  class, you create a (FormRenderer) class that will take a SmartForm as
  an argument (or SmartForm could take a renderer as an argument), and
  render the form into HTML.
 
  class AsPRenderer(FormRenderer):
  class AsULRenderer(FormRenderer):
  class 

[web2py:37302] TypeError: 'NoneType' object is not iterable error when inserting on GAE

2009-12-15 Thread Hillman
I get the following error:

Traceback (most recent call last):
  File C:\DropBox\My Dropbox\Programming Projects\Python
\google_appengine\hillmanwork\gluon\restricted.py, line 173, in
restricted
exec ccode in environment
  File C:\DropBox\My Dropbox\Programming Projects\Python
\google_appengine\hillmanwork\applications\default/controllers/
word0.py:index, line 21218, in module
  File C:\DropBox\My Dropbox\Programming Projects\Python
\google_appengine\hillmanwork\gluon\globals.py, line 96, in lambda
self._caller = lambda f: f()
  File C:\DropBox\My Dropbox\Programming Projects\Python
\google_appengine\hillmanwork\applications\default/controllers/
word0.py:index, line 2, in index
  File C:\DropBox\My Dropbox\Programming Projects\Python
\google_appengine\hillmanwork\gluon\contrib\gql.py, line 137, in
__call__
return Set(self, where)
  File C:\DropBox\My Dropbox\Programming Projects\Python
\google_appengine\hillmanwork\gluon\contrib\gql.py, line 573, in
__init__
self._tables = [filter.left._tablename for filter in
where.filters]
TypeError: 'NoneType' object is not iterable

when executing the following line of code:

db(db.word.insert(word = 'aa'))

The table definition is:

db.define_table('word',
SQLField('word', 'string'))

I am running web2py version 1.74.1, by the way.

Everything works fine on the local sqlite db, but not when uploaded to
GAE, or run with the GAE local launcher.

Any hints?

Thanks.

--

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




[web2py:37303] Re: Excess whitespace in html

2009-12-15 Thread kbochert
Amazingly enough, the following snippet appears to filter excess lines
while leaving pre blocks unchanged!!

import re
def remove_line(mo):
s = mo.group()
if s.startswith('pre'): return s
return '\n'

def filter(d):
if not isinstance(d,dict):  d = d()
pat = re.compile(r'(\n\s\s+\n|(?s)pre.*/pre)')
return pat.sub(remove_line,response.render(d))

response._caller=filter

??
Karl

On Dec 15, 4:14 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 My pre tags are generated by a WYSIWYG editor. It would be highly
 inconvenient to edit the source it generates, just for pre tags to render
 correctly

 -Thadeus




--

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




Re: [web2py:37304] Re: Excess whitespace in html

2009-12-15 Thread Jonathan Lundell
On Dec 15, 2009, at 5:11 PM, kbochert wrote:

 Amazingly enough, the following snippet appears to filter excess lines
 while leaving pre blocks unchanged!!

You might want pre.*?/pre

 
 import re
 def remove_line(mo):
s = mo.group()
if s.startswith('pre'): return s
return '\n'
 
 def filter(d):
if not isinstance(d,dict):  d = d()
pat = re.compile(r'(\n\s\s+\n|(?s)pre.*/pre)')
return pat.sub(remove_line,response.render(d))
 
 response._caller=filter
 
 ??
 Karl
 
 On Dec 15, 4:14 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 My pre tags are generated by a WYSIWYG editor. It would be highly
 inconvenient to edit the source it generates, just for pre tags to render
 correctly
 
 -Thadeus


--

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




[web2py:37305] Re: New features not documented in Book 2nd edition

2009-12-15 Thread mdipierro
are you sating there is a backward incompatibility problem in this?
Can you tell us more?

On Dec 15, 6:05 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 customizable csv has been in the dev since 1.73.1 but didn't actually
 make it into stable until 1.74.1, just an fyi. ( ran into this issue
 on my dev server, trying to use 1.73.1 had to revert to dev for the
 time being)

 -Thadeus

 On Mon, Dec 14, 2009 at 10:40 PM, DenesL denes1...@yahoo.ca wrote:
  1.74.1



--

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




[web2py:37306] Re: Auth-Login : Backward compatibility with the new release 1.74.1

2009-12-15 Thread mdipierro
Yes. This is a bug in tool. I will fix it shortly.

Massimo

On Dec 15, 6:26 pm, Yannick ytchatch...@gmail.com wrote:
 This is a follow up of this 
 thread:http://groups.google.com/group/web2py/browse_thread/thread/f6899f2583...

 Basically now when I migrate my application with this new release and
 trying to login an user with a fake password I'm expecting to have a
 feedback message (error) from the session... But instead there is a
 server error here is the ticket that is generated:

 Traceback (most recent call last):
   File /Users/OnemeWs/App Server/web2py/gluon/restricted.py, line
 173, in restricted
     exec ccode in environment
   File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
 controllers/default.py, line 171, in module

 

   File /Users/OnemeWs/App Server/web2py/gluon/globals.py, line 96,
 in lambda
     self._caller = lambda f: f()
   File /Users/OnemeWs/App Server/web2py/applications/AppDemo/
 controllers/default.py, line 134, in login
     return dict(loginform = auth.login())
   File /Users/OnemeWs/App Server/web2py/gluon/tools.py, line 980, in
 login
     onvalidation=onvalidation):
   File /Users/OnemeWs/App Server/web2py/gluon/sqlhtml.py, line 771,
 in accepts
     onvalidation,
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1267, in
 accepts
     status = self._traverse(status)
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 456, in
 _traverse
     newstatus = self._validate()
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1074, in
 _validate
     (value, errors) = validator(value)
   File /Users/OnemeWs/App Server/web2py/gluon/validators.py, line
 728, in __call__
     if (not self.banned or not self.banned.match(domain)) \
 AttributeError: 'lazyT' object has no attribute 'match'

 

 Does anyone notice this issue in their application after they migrate
 to the new release ?

 Thanks,
 Cheers,
 Yannick P.

--

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




[web2py:37307] Re: Fail login doesn't return an errorm msg

2009-12-15 Thread mdipierro
fixing this tonight

On Dec 15, 6:28 pm, Yannick ytchatch...@gmail.com wrote:
 Hmmm Think there is an issue with this release... Please take a look
 to the ticket generated after a user tried to login using a fake
 password:

 

 Traceback (most recent call last):
   File /Users/OnemeWs/App Server/web2py/gluon/restricted.py, line
 173, in restricted
     exec ccode in environment
   File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
 controllers/default.py, line 171, in module

   File /Users/OnemeWs/App Server/web2py/gluon/globals.py, line 96,
 in lambda
     self._caller = lambda f: f()
   File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
 controllers/default.py, line 134, in login
     return dict(loginform = auth.login())
   File /Users/OnemeWs/App Server/web2py/gluon/tools.py, line 980, in
 login
     onvalidation=onvalidation):
   File /Users/OnemeWs/App Server/web2py/gluon/sqlhtml.py, line 771,
 in accepts
     onvalidation,
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1267, in
 accepts
     status = self._traverse(status)
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
 _traverse
     newstatus = c._traverse(status) and newstatus
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 456, in
 _traverse
     newstatus = self._validate()
   File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1074, in
 _validate
     (value, errors) = validator(value)
   File /Users/OnemeWs/App Server/web2py/gluon/validators.py, line
 728, in __call__
     if (not self.banned or not self.banned.match(domain)) \
 AttributeError: 'lazyT' object has no attribute 'match'

 

 Anyway idea ?

 Yannick P.

 On Dec 14, 11:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I do not know. Glad it is fixed anyway.

  On Dec 14, 9:19 pm, Yannick ytchatch...@gmail.com wrote:

   Hello Massimo,
   Thanks I just test the new release and realized that the double
   redirect seem to be fixed on the Auth - Login I just wonder what
   was the root of the issue I got in the previous release...

   Thanks

   On Dec 12, 12:31 pm, Yannick ytchatch...@gmail.com wrote:

Hello Massimo, thanks for the note...
i did follow your instructions which was :
1) I put this in the view {{=loginform}}
2) I print request.function and request.vars from the model
And here is what i see:
login
Storage {'email': 'sdfsdf...@efsdf.cfd', '_formkey':
'440a019c-1479-4b0d-8e86-b27c0496dd7a', 'password': '12w12123',
'_formname': 'login', '_next': ''}
login
Storage {}

It looks like there is a double redirect...

I did create a small brand new application just to test the login with
Auth using the web2py admin console ( Just to double check that is not
my code which cause this) and I have the same result...

I'll send you the code that I used to test it... I really don't know
why that happen, I think it use to work in the pass...

Thanks for your help...

Cheers,
Yannick P.

On Dec 11, 9:59 am, mdipierro mdipie...@cs.depaul.edu wrote:

 For debugging purposes

 1) try replace everything in the view with {{=loginform}}

 2) try print request.function, request.vars

 what do you see?

 Feel free to send me your code and I will take a look.

 massimo

 On Dec 11, 8:47 am, Yannick ytchatch...@gmail.com wrote:

  Yes I did comment this out auth.settings.login_next=URL(r=request,
  f='profile') 
  but still same old, the double redirect is still there... I really
  wonder what trigger that double redirection... there is nothing 
  extra
  I'm doing here, I fulling using Auth API... Hmmm...

  On Dec 11, 9:33 am, Wes James compte...@gmail.com wrote:

   On Thu, Dec 10, 2009 at 8:09 PM, Yannick ytchatch...@gmail.com 
   wrote:
Hello thanks for the note...

I did add print request.function
and Yes there is a double redirection because the output print 
the
function login twice :
login
login

I wonder how to fix this double redirection here is one of the 
setting
I have in my controller:
auth.settings.login_next=URL(r=request, f='profile')

   comment this out just to see what happens...

   or use wingide and see where it goes.

Do you have any idea... I'll keep debugging...

On Dec 9, 

[web2py:37308] Re: Dynamic CSS

2009-12-15 Thread mdipierro
yes. Nothing special. Just make a view.css file and include it in the
layout.

On Dec 15, 6:38 pm, kbochert kboch...@copper.net wrote:
 Just a thought---
 Is it possible to serve a css file through the template system?

 It might be very useful to be able to use css like:

 {{ # define the colors }}
 {{primary_color = 0xff3366}}

 body {
     color: {{=primary_color}} ;

     background-color: {{= response.users_background}} ;
     ...

 }

 Karl

--

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




[web2py:37309] Re: TypeError: 'NoneType' object is not iterable error when inserting on GAE

2009-12-15 Thread mdipierro
This line

db(db.word.insert(word = 'aa'))

is not a valid DAL syntax.

db.word.insert(word = 'aa') is correct and
db(query).select()

is correct but the result of the insert is not a query.

Massimo


On Dec 15, 7:11 pm, Hillman hillma...@gmail.com wrote:
 I get the following error:

 Traceback (most recent call last):
   File C:\DropBox\My Dropbox\Programming Projects\Python
 \google_appengine\hillmanwork\gluon\restricted.py, line 173, in
 restricted
     exec ccode in environment
   File C:\DropBox\My Dropbox\Programming Projects\Python
 \google_appengine\hillmanwork\applications\default/controllers/
 word0.py:index, line 21218, in module
   File C:\DropBox\My Dropbox\Programming Projects\Python
 \google_appengine\hillmanwork\gluon\globals.py, line 96, in lambda
     self._caller = lambda f: f()
   File C:\DropBox\My Dropbox\Programming Projects\Python
 \google_appengine\hillmanwork\applications\default/controllers/
 word0.py:index, line 2, in index
   File C:\DropBox\My Dropbox\Programming Projects\Python
 \google_appengine\hillmanwork\gluon\contrib\gql.py, line 137, in
 __call__
     return Set(self, where)
   File C:\DropBox\My Dropbox\Programming Projects\Python
 \google_appengine\hillmanwork\gluon\contrib\gql.py, line 573, in
 __init__
     self._tables = [filter.left._tablename for filter in
 where.filters]
 TypeError: 'NoneType' object is not iterable

 when executing the following line of code:

 db(db.word.insert(word = 'aa'))

 The table definition is:

 db.define_table('word',
                 SQLField('word', 'string'))

 I am running web2py version 1.74.1, by the way.

 Everything works fine on the local sqlite db, but not when uploaded to
 GAE, or run with the GAE local launcher.

 Any hints?

 Thanks.

--

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




Re: [web2py:37310] Re: New features not documented in Book 2nd edition

2009-12-15 Thread Thadeus Burgess
No. I mean that the custom csv patch (to allow custom definition of
delimiter) has been in SVN since the 1.73.1 release. however it was not
included in the 1.73.1 release, so downloading src from
web2py.com/downloadsdid not include this patch (necessary for my app).
The reasoning is if you
are running 1.73.1 from the posted web2py_src.zip you will not have custom
csv. However with 1.74.1 this patch was included, so you can use it.

I was bringing this up so that custom csv can be placed under 1.74.1 instead
of 1.73.1.

-Thadeus




On Tue, Dec 15, 2009 at 7:57 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 are you sating there is a backward incompatibility problem in this?
 Can you tell us more?

 On Dec 15, 6:05 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  customizable csv has been in the dev since 1.73.1 but didn't actually
  make it into stable until 1.74.1, just an fyi. ( ran into this issue
  on my dev server, trying to use 1.73.1 had to revert to dev for the
  time being)
 
  -Thadeus
 
  On Mon, Dec 14, 2009 at 10:40 PM, DenesL denes1...@yahoo.ca wrote:
   1.74.1
 
 

 --

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




--

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




[web2py:37311] Re: Fail login doesn't return an errorm msg

2009-12-15 Thread mdipierro
I think this is now fixed in trunk. Can you confirm?

On Dec 15, 8:04 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 fixing this tonight

 On Dec 15, 6:28 pm, Yannick ytchatch...@gmail.com wrote:

  Hmmm Think there is an issue with this release... Please take a look
  to the ticket generated after a user tried to login using a fake
  password:

  

  Traceback (most recent call last):
    File /Users/OnemeWs/App Server/web2py/gluon/restricted.py, line
  173, in restricted
      exec ccode in environment
    File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
  controllers/default.py, line 171, in module

    File /Users/OnemeWs/App Server/web2py/gluon/globals.py, line 96,
  in lambda
      self._caller = lambda f: f()
    File /Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
  controllers/default.py, line 134, in login
      return dict(loginform = auth.login())
    File /Users/OnemeWs/App Server/web2py/gluon/tools.py, line 980, in
  login
      onvalidation=onvalidation):
    File /Users/OnemeWs/App Server/web2py/gluon/sqlhtml.py, line 771,
  in accepts
      onvalidation,
    File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1267, in
  accepts
      status = self._traverse(status)
    File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
  _traverse
      newstatus = c._traverse(status) and newstatus
    File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
  _traverse
      newstatus = c._traverse(status) and newstatus
    File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
  _traverse
      newstatus = c._traverse(status) and newstatus
    File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 449, in
  _traverse
      newstatus = c._traverse(status) and newstatus
    File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 456, in
  _traverse
      newstatus = self._validate()
    File /Users/OnemeWs/App Server/web2py/gluon/html.py, line 1074, in
  _validate
      (value, errors) = validator(value)
    File /Users/OnemeWs/App Server/web2py/gluon/validators.py, line
  728, in __call__
      if (not self.banned or not self.banned.match(domain)) \
  AttributeError: 'lazyT' object has no attribute 'match'

  

  Anyway idea ?

  Yannick P.

  On Dec 14, 11:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I do not know. Glad it is fixed anyway.

   On Dec 14, 9:19 pm, Yannick ytchatch...@gmail.com wrote:

Hello Massimo,
Thanks I just test the new release and realized that the double
redirect seem to be fixed on the Auth - Login I just wonder what
was the root of the issue I got in the previous release...

Thanks

On Dec 12, 12:31 pm, Yannick ytchatch...@gmail.com wrote:

 Hello Massimo, thanks for the note...
 i did follow your instructions which was :
 1) I put this in the view {{=loginform}}
 2) I print request.function and request.vars from the model
 And here is what i see:
 login
 Storage {'email': 'sdfsdf...@efsdf.cfd', '_formkey':
 '440a019c-1479-4b0d-8e86-b27c0496dd7a', 'password': '12w12123',
 '_formname': 'login', '_next': ''}
 login
 Storage {}

 It looks like there is a double redirect...

 I did create a small brand new application just to test the login with
 Auth using the web2py admin console ( Just to double check that is not
 my code which cause this) and I have the same result...

 I'll send you the code that I used to test it... I really don't know
 why that happen, I think it use to work in the pass...

 Thanks for your help...

 Cheers,
 Yannick P.

 On Dec 11, 9:59 am, mdipierro mdipie...@cs.depaul.edu wrote:

  For debugging purposes

  1) try replace everything in the view with {{=loginform}}

  2) try print request.function, request.vars

  what do you see?

  Feel free to send me your code and I will take a look.

  massimo

  On Dec 11, 8:47 am, Yannick ytchatch...@gmail.com wrote:

   Yes I did comment this out 
   auth.settings.login_next=URL(r=request,
   f='profile') 
   but still same old, the double redirect is still there... I really
   wonder what trigger that double redirection... there is nothing 
   extra
   I'm doing here, I fulling using Auth API... Hmmm...

   On Dec 11, 9:33 am, Wes James compte...@gmail.com wrote:

On Thu, Dec 10, 2009 at 8:09 PM, Yannick 
ytchatch...@gmail.com wrote:
 Hello thanks for the note...

 I did add print request.function
 and Yes there is a double redirection because the output 
 print the
 function login twice :
 login
 login

 I wonder how to fix this double redirection here is one of 
 the setting
 I have in my controller:

[web2py:37312] Re: r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread mdipierro
I think this is now fixed in trunk. can you confirm?

massimo

On Dec 15, 4:52 pm, Fran francisb...@googlemail.com wrote:
 On Dec 15, 10:40 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I need a concrete example of URL and what you find in vars, get_vars
  and post_vars

 Model:
 db.define_table('atable',
                 Field('afield'))

 Controller:
 def test():
     form = crud.create(db.atable)
     return dict(form=form)

 URL:http://127.0.0.1:8000/sahana/test/test?format=test
 request.vars    afield          wqrrwqe         _formkey        
 880cbe69-a4fc-43cc-
 a97d-724c215601ba       _formname       atable/None     _next
 request.get_vars        format  test
 request.post_vars       afield  wqrrwqe         _formkey        
 880cbe69-a4fc-43cc-
 a97d-724c215601ba       _formname       atable/None     _next

--

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




[web2py:37313] Re: ldap authentication stopped working: enter a valid email address

2009-12-15 Thread mdipierro
Please check out trunk and do

auth.settings.login_email_validate = False

does it solve your problem?

This is a temporary solution. ldap module needs to be changed to use
username and not email. The current use of email should be considered
a bug.

On Dec 15, 1:44 pm, Fred fre...@gmail.com wrote:
 That IS_EMAIL() temporary validator is exactly what I *don't* want for
 LDAP authentication.

--

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




[web2py:37315] Re: SQLFORM, no-table, with fieldsets.

2009-12-15 Thread DenesL
On Dec 15, 7:49 pm, Thadeus Burgess thade...@thadeusb.com wrote:

 class PRenderer(FormRenderer):
    def __init__(form):
        ...
    def __call__():
        return FORM(
        for field in self.form.fields
         P(
             LABEL(field.label+:),
                 field.widget,
                 field.comment,
         ),

Almost a copy of my class, feels like the natural way to go.

--

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




[web2py:37316] Re: Excess whitespace in html

2009-12-15 Thread DenesL
Looking good..

On Dec 15, 8:11 pm, kbochert kboch...@copper.net wrote:
 Amazingly enough, the following snippet appears to filter excess lines
 while leaving pre blocks unchanged!!

 import re
 def remove_line(mo):
     s = mo.group()
     if s.startswith('pre'):     return s
     return '\n'

 def filter(d):
     if not isinstance(d,dict):  d = d()
     pat = re.compile(r'(\n\s\s+\n|(?s)pre.*/pre)')
     return pat.sub(remove_line,response.render(d))

 response._caller=filter

 ??
 Karl

 On Dec 15, 4:14 pm, Thadeus Burgess thade...@thadeusb.com wrote:

  My pre tags are generated by a WYSIWYG editor. It would be highly
  inconvenient to edit the source it generates, just for pre tags to render
  correctly

  -Thadeus

--

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




Re: [web2py:37317] web2py blog screencast

2009-12-15 Thread Alex Fanjul
Downloading!!! does it include any new feature Mengu? or are the book 
standard ones?
Thanks a lot!
Alex F

El 16/12/2009 4:01, Mengu escribió:
 hi everyone,

 i have recorded a blog screencast which i think may help many web2py
 beginners. it includes:
 - how to use sqlform,
 - how to customize sqlform,
 - how to use DAL,
 - how to use joins,
 - how to create categories
 - how to implement tagging
 - how to add new menus

 i tried to be clean on the codes as much as possible but didn't pay
 attention on styling / design of the pages. please download the
 screencast at http://rapidshare.com/files/321445375/blogscreencast.mp4.zip
 and let me know your thoughts.

 Mengu

 --

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





-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--

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




[web2py:37318] Re: TypeError: 'NoneType' object is not iterable error when inserting on GAE

2009-12-15 Thread Hillman
Thanks. I am not sure where I got the syntax I was using.

Also, I find it odd that the syntax that shouldn't work actually does
when working with a sqlite db.

On Dec 15, 7:09 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 This line

 db(db.word.insert(word = 'aa'))

 is not a valid DAL syntax.

 db.word.insert(word = 'aa') is correct and
 db(query).select()

 is correct but the result of the insert is not a query.

 Massimo

 On Dec 15, 7:11 pm, Hillman hillma...@gmail.com wrote:

  I get the following error:

  Traceback (most recent call last):
    File C:\DropBox\My Dropbox\Programming Projects\Python
  \google_appengine\hillmanwork\gluon\restricted.py, line 173, in
  restricted
      exec ccode in environment
    File C:\DropBox\My Dropbox\Programming Projects\Python
  \google_appengine\hillmanwork\applications\default/controllers/
  word0.py:index, line 21218, in module
    File C:\DropBox\My Dropbox\Programming Projects\Python
  \google_appengine\hillmanwork\gluon\globals.py, line 96, in lambda
      self._caller = lambda f: f()
    File C:\DropBox\My Dropbox\Programming Projects\Python
  \google_appengine\hillmanwork\applications\default/controllers/
  word0.py:index, line 2, in index
    File C:\DropBox\My Dropbox\Programming Projects\Python
  \google_appengine\hillmanwork\gluon\contrib\gql.py, line 137, in
  __call__
      return Set(self, where)
    File C:\DropBox\My Dropbox\Programming Projects\Python
  \google_appengine\hillmanwork\gluon\contrib\gql.py, line 573, in
  __init__
      self._tables = [filter.left._tablename for filter in
  where.filters]
  TypeError: 'NoneType' object is not iterable

  when executing the following line of code:

  db(db.word.insert(word = 'aa'))

  The table definition is:

  db.define_table('word',
                  SQLField('word', 'string'))

  I am running web2py version 1.74.1, by the way.

  Everything works fine on the local sqlite db, but not when uploaded to
  GAE, or run with the GAE local launcher.

  Any hints?

  Thanks.



--

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




[web2py:37319] Re: r1433 breaks app: GET vars no longer processed on POSTs

2009-12-15 Thread howesc
ran into this too.  the version from trunk works.  (i'm using python
2.5.2)

thanks,

cfh

On Dec 15, 6:38 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I think this is now fixed in trunk. can you confirm?

 massimo

 On Dec 15, 4:52 pm, Fran francisb...@googlemail.com wrote:

  On Dec 15, 10:40 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I need a concrete example of URL and what you find in vars, get_vars
   and post_vars

  Model:
  db.define_table('atable',
                  Field('afield'))

  Controller:
  def test():
      form = crud.create(db.atable)
      return dict(form=form)

  URL:http://127.0.0.1:8000/sahana/test/test?format=test
  request.vars    afield          wqrrwqe         _formkey        
  880cbe69-a4fc-43cc-
  a97d-724c215601ba       _formname       atable/None     _next
  request.get_vars        format  test
  request.post_vars       afield  wqrrwqe         _formkey        
  880cbe69-a4fc-43cc-
  a97d-724c215601ba       _formname       atable/None     _next



--

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




[web2py:37320] web2py 1.73.1, apache2 and wsgi, postgresql

2009-12-15 Thread Wes James
I have been trying to get web2py to work with
apache2/mod_wsgi/postgresql via psycopg2.  I keep getting a ticket
that pycopg2 can't  be found.

I then run sudo -u user python and try to import psycopg2 and it comes
up with import error access denied to /var/root/.python-eggs and says
to change the PYTHON_EGG_CACHE.  So I did that but it still wants to
go to /var/root/.python-eggs.

So I see that it is try to write to the cache but can't.

I ran web2py -M -a recycle -p someport and -i someIP and all works fine.

Does someone know how to get the psycopg2 part working with wsgi?

thx,

-wes

--

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




[web2py:37321] Re: Form element definition examples

2009-12-15 Thread mr.freeze
I made a slice with a few more examples:
http://www.web2pyslices.com/main/slices/take_slice/43

On Dec 15, 4:17 pm, mr.freeze nat...@freezable.com wrote:
 element and elements take any combination of args and keywords and
 cycle through the form components looking for match(es)

 form.element('input',_type='text')# grabs the first text input
 form.elements('input',_type='text')# grabs all text inputs

 form.elements('input','textarea') # grabs all inputs and textareas

 On Dec 15, 2:02 pm, waTR r...@devshell.org wrote:

  Is there a definition of all possible arguments for form.element and
  some examples somewhere?

  I am mainly looking to use it with SQLForm and factory().
  Specifically, I want to create a form with SQLForm  factory, and then
  modify some of the elements to be things other than text boxes, i.e.
  to change some to drop-downs with some choices, and others to radio
  buttons, etc.

  Is the above possible? And with what element argument?



--

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




[web2py:37322] Re: web2py 1.73.1, apache2 and wsgi, postgresql

2009-12-15 Thread Wes James
More specific error:

NameError: global name 'psycopg2' is not defined

On Tue, Dec 15, 2009 at 9:31 PM, Wes James compte...@gmail.com wrote:
 I have been trying to get web2py to work with
 apache2/mod_wsgi/postgresql via psycopg2.  I keep getting a ticket
 that pycopg2 can't  be found.

 I then run sudo -u user python and try to import psycopg2 and it comes
 up with import error access denied to /var/root/.python-eggs and says
 to change the PYTHON_EGG_CACHE.  So I did that but it still wants to
 go to /var/root/.python-eggs.

 So I see that it is try to write to the cache but can't.

 I ran web2py -M -a recycle -p someport and -i someIP and all works fine.

 Does someone know how to get the psycopg2 part working with wsgi?

 thx,

 -wes


--

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




  1   2   >