[web2py] Re: web2py blog screencast

2010-01-24 Thread waTR
The screencast mentioned in this thread should be added to a list of
"Read/watch first if your new" on the user group, and make it a
sticky.



On Jan 24, 10:41 pm, Mengu  wrote:
> i see many new people coming to the group and asking the same
> questions. please at least watch the screencast on this thread.

-- 
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] Re: Haiti: Spreadsheet importer needed

2010-01-24 Thread Mengu
Hi Fran,

Any info on your table data? I can do this.

On 23 Ocak, 19:58, Fran  wrote:
> On Jan 23, 5:11 pm, Thadeus Burgess  wrote:
>
> > I took a look but I still don't quite understand what you are
> > importing into web2py
>
> Thanks...we have various source materials that need importing.
> The one that I did succesfully (although I still need to do cleanups
> as LatLons got truncated!) & (long!) process for which I documented is
> here:http://spreadsheets.google.com/ccc?key=0Aoyf-OlHreuhdGwzbWNmWXVpX1F1R...
>
> One which we need to keep regularly synced is this 
> style:http://docs.google.com/leaf?id=0Al90o_SVeUkFdGZRcGNrVGFCU2UtUW01NDdke...
>
> 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] Re: web2py blog screencast

2010-01-24 Thread Mengu
i see many new people coming to the group and asking the same
questions. please at least watch the screencast on this thread.

-- 
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] Re: Blogitizor Open Sourced

2010-01-24 Thread Richard
yeah I was also attracted to the admin look and feel.

web2py needs a RadiantCMS clone too! I started on a basic version last
week for my own use, but it is not intended to be as ambitious as
RadiantCMS/FrogCMS (I'm not sure what features HazelCMS covers).


On Jan 25, 12:48 pm, Thadeus Burgess  wrote:
> Interesting, because HazelCMS is the werkzeug clone of frogcms which
> is the clone of radiantcms.
>
> Funny how the wheel turns round, everyone wants to implement the same
> thing in their own framework i'm sure there is a django clone of
> this as well. I just liked the Admin page layout and felt it was
> suiting.
>
> -Thadeus
>
>
>
> On Sun, Jan 24, 2010 at 7:43 PM, Richard  wrote:
> > Thanks for taking the effort to extract this from your personal site.
> > Have submitted those issues as tickets.
>
> > Ah I thought the admin layout seemed familiar - I had been evaluating
> > RadiantCMS (RoR), which FrogCMS is a PHP clone of.
>
> > Richard
>
> > On Jan 25, 12:15 pm, Thadeus Burgess  wrote:
> >> And the problem with not adding categories is probably a simple fix in
> >> the SQLFORM requires.
>
> >> DO you mind filling out issue tickets on google code for these?
>
> >> -Thadeus
>
> >> On Sun, Jan 24, 2010 at 7:13 PM, Thadeus Burgess  
> >> wrote:
> >> > thadeusb.com is running blogitizor :)
>
> >> > the admin panel comes from frogcms.
>
> >> > So here is the story, I started this to be my website, so I have a
> >> > theme based around python variables (if you visit my site you will
> >> > quickly see). This is just part of that theme, and these should be
> >> > included in the Configure() settings database at some point. There is
> >> > still alot left to do to add features, and there is still a bit of
> >> > cleanup that needs to be done. So what I did for blogitizor was take
> >> > my website, strip it of as much personal things as I could such as my
> >> > site theme etc etc, and then posted it.
>
> >> > oops, my bad on the broken symlinks. The py2jquery I don't even use
> >> > except for a better alternative to response.files. I need to remove
> >> > the dependency for it.
>
> >> > the layout.html simlink is because I have several layouts that can be
> >> > used, and it allows to easily switch between them. Since my layout is
> >> > mine I did not want to include it in blogitizor so I had to hack up a
> >> > quick template, I don't like it and might use something like wordpress
> >> > default theme.
>
> >> > I don't use localhost for developement, I bind to my PC's ip on the
> >> > router, since I like to be able to fire up my windows box and check
> >> > the site on IE, I suppose its one of those things everyone will need
> >> > to edit for their self, but perhaps a meta is_devel() or PRODUCTION =
> >> > True to be used in the end.
>
> >> > thanks for the patches
>
> >> > the XML is a patch that Massimo has obviously yet to apply. It is a
> >> > bug in web2py WIKI helper instead of passing extras to markdown its
> >> > passing extras to XML which is incorrect, you can look at my google
> >> > clone of web2py gluon/contrib/markdown/__init__.py for the patch.
>
> >> > -Thadeus
>
> >> > On Sun, Jan 24, 2010 at 6:13 PM, Richard  wrote:
> >> >> hi Thadeus,
>
> >> >> this code has heaps of awesome snippets that will be useful to reuse -
> >> >> thanks for sharing!
>
> >> >> I love the black admin layout you've used with the flash message
> >> >> embedded in the top section - do you mind if I reuse it?
> >> >> And do you have a live website using blogitizer?
>
> >> >> I noticed a few problems, which I will email to you.
>
> >> >> Richard
>
> >> >> On Jan 24, 9:48 pm, Thadeus Burgess  wrote:
> >> >>> Ok. So I give it to you, the source of blogitizor. Its not my best
> >> >>> work, but I am limited by the quirks of web applications :(
>
> >> >>>http://code.google.com/p/blogitizor/
>
> >> >>> There is a install notes and dependencies on the wiki.
>
> >> >>> Just some notes to help navigate, I use letters to execute models in
> >> >>> the correct order, I have a class that handles configurations and in
> >> >>> the progress of merging all of the code to use a settings database
> >> >>> where applicable.
>
> >> >>> There is also a menumanager class to help handle/render menus.
>
> >> >>> Output is automatically compressed when in an production environment.
>
> >> >>> models/z_migrate will actually migrate your wordpress over if you have
> >> >>> any, to do this go to admin controller, and imex, then browse for your
> >> >>> wordpress.xml export file, and click wordpress import.
>
> >> >>> layout.html is just a softlink to efflorescenetorange, so you might
> >> >>> need to recreate it. I would suggest making your own layout, I don't
> >> >>> like the orange one but was wanting to get this out there at least.
>
> >> >>> you will need to install guppy and pygments to use this, hopefully I
> >> >>> can have these optional dependencies instead of required later on.
>
> >> >>> If anybody would like to start helpin

[web2py] Re: AJAX with custom widget

2010-01-24 Thread weheh
OK, now I'm scared. I don't even know what file the custom widget is
supposed to live in (and I've read the doc, I swear). Do you know of
any good examples I could look at on doing an AJAX call on a drop down
list, where the drop down value is used to pick a value from a table
and then send it back to the view to update a div?

On Jan 24, 11:03 pm, mdipierro  wrote:
> yes
>
> On Jan 24, 9:15 pm, weheh  wrote:
>
> > I'm combining two tables into one form (yet again). I'm using
> > SQLFORM.factory(db.auth_user,db.table1) to combine the 2 tables into 1
> > form. All fields have unique names.
>
> > I am custom designing the form to make it more compact than the linear
> > approach used by SQLFORM. Therefore, I end up using
> > form.custom.begin ... form.custom.widget.fieldname ...
> > form.custom.end.
>
> > One of the widgets is a drop-down list. Based on the value of the drop
> > down, I want to query the db and get a cost information on the fly and
> > update the form with this information. Do I need to write a
> > custom.widget to make this work? How else can I get the AJAX script to
> > talk to the form?

-- 
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] Re: How to set default value based on query [RESOLVED]

2010-01-24 Thread weheh
Yup, of course, you are right as usual Mr. MDP. Which is why I want to
fatten you up so you'll slow down a little and let ordinary mortals
like me catch up. My mistake was in the IS_IN_DP syntax. I lied in my
earlier note where I said that I did exactly what you wrote. In fact,
I had written almost exactly what I put in my original note to open
this thread. I'm closing this and moving on. THANKS!

On Jan 24, 11:06 pm, mdipierro  wrote:
> This defines the field as a reference
>
>    Field('make',db.car_makers)
>
> This makes the dropdown
>
>    db.car.make.requires = IS_IN_DB(db,db.car_makers.id,'%(name)s')
>
> This selects the default option on create forms (not on update forms)
> and caches it
>
>    db.car.make.default = db(db.car_makers.name=='Ford').select
> (db.car_makers.id,cache=(cache.ram,3600)).first().id
>
> This MUST work.
>
> On Jan 24, 9:17 pm, weheh  wrote:
>
> > When I go to the URL that displays the form, I see Edsel in the
> > pulldown, not Ford. p.s.  I've never used caching. Do you have a quick
> > answer for how to do it? Thx. - RG
>
> > On Jan 24, 10:12 pm, mdipierro  wrote:
>
> > > how doesn't work?
>
> > > P.S. you should cache this for speed:
>
> > > db.car.make.default = db(db.car_makers.name=='Ford').select
> > > (db.car_makers.id,cache=(cache.ram,3600)).first().id
>
> > > On Jan 24, 9:01 pm, weheh  wrote:
>
> > > > Sorry. I was writing off the top of my head. Of course, I did exactly
> > > > what you wrote in my actual code. Still doesn't work.
>
> > > > On Jan 24, 9:53 pm, mdipierro  wrote:
>
> > > > > I think you want:
>
> > > > > Field('make',db.car_makers,IS_IN_DB(db,db.car_makers.id,'%(name)s')
>
> > > > > and
>
> > > > > db.car.make.default = db(db.car_makers.name=='Ford').select
> > > > > (db.car_makers.id).first().id
>
> > > > > On Jan 24, 8:46 pm, weheh  wrote:
>
> > > > > > I'm certain this has been asked a bunch of times. I've spent the 
> > > > > > last
> > > > > > hour looking for it but can't find it anywhere. Sorry.
>
> > > > > > The question is how to set the default value of a reference field
> > > > > > based on a query of the referenced table.
>
> > > > > > db.define_table('car_makers',Field('name',unique=True))
> > > > > > db.define_table('car',
> > > > > >   Field('make',db.car_makers,IS_IN_DB(db,'car_makers.name','%(name)
> > > > > > s')),
> > > > > >   Field('model'))
>
> > > > > > I want to set 
> > > > > > db.car.make.default=db(db.car_makers.name=='Ford').select
> > > > > > (db.car_makers.id)[0]
> > > > > > so that when I do an SQLFORM, the drop down list of db.car.make will
> > > > > > pre-select "Ford".
>
> > > > > > This isn't working for me. What am I doing wrong?

-- 
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] Re: How to set default value based on query

2010-01-24 Thread mdipierro
This defines the field as a reference

   Field('make',db.car_makers)

This makes the dropdown

   db.car.make.requires = IS_IN_DB(db,db.car_makers.id,'%(name)s')

This selects the default option on create forms (not on update forms)
and caches it

   db.car.make.default = db(db.car_makers.name=='Ford').select
(db.car_makers.id,cache=(cache.ram,3600)).first().id

This MUST work.

On Jan 24, 9:17 pm, weheh  wrote:
> When I go to the URL that displays the form, I see Edsel in the
> pulldown, not Ford. p.s.  I've never used caching. Do you have a quick
> answer for how to do it? Thx. - RG
>
> On Jan 24, 10:12 pm, mdipierro  wrote:
>
> > how doesn't work?
>
> > P.S. you should cache this for speed:
>
> > db.car.make.default = db(db.car_makers.name=='Ford').select
> > (db.car_makers.id,cache=(cache.ram,3600)).first().id
>
> > On Jan 24, 9:01 pm, weheh  wrote:
>
> > > Sorry. I was writing off the top of my head. Of course, I did exactly
> > > what you wrote in my actual code. Still doesn't work.
>
> > > On Jan 24, 9:53 pm, mdipierro  wrote:
>
> > > > I think you want:
>
> > > > Field('make',db.car_makers,IS_IN_DB(db,db.car_makers.id,'%(name)s')
>
> > > > and
>
> > > > db.car.make.default = db(db.car_makers.name=='Ford').select
> > > > (db.car_makers.id).first().id
>
> > > > On Jan 24, 8:46 pm, weheh  wrote:
>
> > > > > I'm certain this has been asked a bunch of times. I've spent the last
> > > > > hour looking for it but can't find it anywhere. Sorry.
>
> > > > > The question is how to set the default value of a reference field
> > > > > based on a query of the referenced table.
>
> > > > > db.define_table('car_makers',Field('name',unique=True))
> > > > > db.define_table('car',
> > > > >   Field('make',db.car_makers,IS_IN_DB(db,'car_makers.name','%(name)
> > > > > s')),
> > > > >   Field('model'))
>
> > > > > I want to set 
> > > > > db.car.make.default=db(db.car_makers.name=='Ford').select
> > > > > (db.car_makers.id)[0]
> > > > > so that when I do an SQLFORM, the drop down list of db.car.make will
> > > > > pre-select "Ford".
>
> > > > > This isn't working for me. What am I doing wrong?
>
>

-- 
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] Re: EOFError?

2010-01-24 Thread vince
I still find the error appear random, is it possible to trace the URL
of each error?

On Jan 25, 3:24 am, mdipierro  wrote:
> You can have a problem with sqlite if you remove a field and you add
> it again with the same name.
>
> This is because sqlite does not support ALTER TABLE ... DROP.
>
> Massimo
>
> On Jan 24, 1:21 pm, vince  wrote:
>
>
>
> > i can't sort out how to reproduce it anyway, it's not happening
> > everytime i add a field. i'll see if the clean up of .table works
>
> > On Jan 25, 2:58 am, vince  wrote:
>
> > > i just did some test and the error seems to appear  when i modify the
> > > table definition, eg add a new field with migrate=true.
> > > it will only appear in the error log and i won't see the actually
> > > error ticket on browsing.
>
> > > On Jan 25, 1:12 am, mdipierro  wrote:
>
> > > > web2py will only recreate them if
>
> > > > a) you also delete the database itself (for sqlite, you must delete
> > > > everything in databases)
>
> > > > OR
>
> > > > b) you know for sure that the current models reflect exactly the
> > > > structure of the database tables and you set "db.define_table
> > > > (...,fake_migrate=True)" for all tables.
>
> > > > In any case. Make a backup of the .tables before you delete them. In
> > > > theory, if you lose them it is always possible to rebuild them (they
> > > > are just picked files.
> > > > Massimo
>
> > > > On Jan 24, 10:54 am, vince  wrote:
>
> > > > > i just double check and it should not be file permission issue.
>
> > > > > is it safe to just delete all .table? web2py will auto recreate them?
>
> > > > > On Jan 25, 12:44 am, mdipierro  wrote:
>
> > > > > > I can only see three possible causes of the problem:
> > > > > > 1) bug in your version of pickle
> > > > > > 2) file permission issue
> > > > > > 3) there are some .table files in you databases folder that were
> > > > > > created by a different python dictribution
>
> > > > > > On Jan 24, 10:16 am, vince  wrote:
>
> > > > > > > i am running from source on linux and mac.
>
> > > > > > > On Jan 23, 6:36 am, mdipierro  wrote:
>
> > > > > > > > Are you using the web2py binary or source?
> > > > > > > > Did you delete only the .table or everything in databases?
> > > > > > > > Does you app run if you set migrate=False for all tables?
>
> > > > > > > > Massimo
>
> > > > > > > > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > > > > > > > Hmm, I've been running into this problem a bunch today. WinXP 
> > > > > > > > > with
> > > > > > > > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > > > > > > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > > > > > > > ~Brian
>
> > > > > > > > > On Jan 22, 2:13 pm, Thadeus Burgess  
> > > > > > > > > wrote:
>
> > > > > > > > > > looks like a corrupted .table file
> > > > > > > > > > -Thadeus
>
> > > > > > > > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  
> > > > > > > > > > wrote:
> > > > > > > > > > > i just look into the error log for some clean up and 
> > > > > > > > > > > found several
> > > > > > > > > > > ticket with the following errors. i am using 1.74.6, any 
> > > > > > > > > > > ideas?
>
> > > > > > > > > > > Traceback (most recent call last):
> > > > > > > > > > >  File 
> > > > > > > > > > > "/Library/WebServer/Documents/web2py/gluon/restricted.py",
> > > > > > > > > > >  line
> > > > > > > > > > > 173, in restricted
> > > > > > > > > > >    exec ccode in environment
> > > > > > > > > > >  File 
> > > > > > > > > > > "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > > > > > > > db.py", line 137, in 
> > > > > > > > > > >    migrate=is_migrate)
> > > > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > > > line 1252,
> > > > > > > > > > > in define_table
> > > > > > > > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > > > line 1703,
> > > > > > > > > > > in _create
> > > > > > > > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > > > > > > > EOFError
>
> > > > > > > > > > > --
> > > > > > > > > > > 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] Re: AJAX with custom widget

2010-01-24 Thread mdipierro
yes

On Jan 24, 9:15 pm, weheh  wrote:
> I'm combining two tables into one form (yet again). I'm using
> SQLFORM.factory(db.auth_user,db.table1) to combine the 2 tables into 1
> form. All fields have unique names.
>
> I am custom designing the form to make it more compact than the linear
> approach used by SQLFORM. Therefore, I end up using
> form.custom.begin ... form.custom.widget.fieldname ...
> form.custom.end.
>
> One of the widgets is a drop-down list. Based on the value of the drop
> down, I want to query the db and get a cost information on the fly and
> update the form with this information. Do I need to write a
> custom.widget to make this work? How else can I get the AJAX script to
> talk to the form?

-- 
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] Re: Mac Apache

2010-01-24 Thread vince
just compile your own version of mod_wsgi

On Jan 24, 2:42 am, pistacchio  wrote:
> Has anyone succesfully run web2py under Mac OSX apache? Any guide?
> 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] Re: How to set default value based on query

2010-01-24 Thread weheh
When I go to the URL that displays the form, I see Edsel in the
pulldown, not Ford. p.s.  I've never used caching. Do you have a quick
answer for how to do it? Thx. - RG

On Jan 24, 10:12 pm, mdipierro  wrote:
> how doesn't work?
>
> P.S. you should cache this for speed:
>
> db.car.make.default = db(db.car_makers.name=='Ford').select
> (db.car_makers.id,cache=(cache.ram,3600)).first().id
>
> On Jan 24, 9:01 pm, weheh  wrote:
>
> > Sorry. I was writing off the top of my head. Of course, I did exactly
> > what you wrote in my actual code. Still doesn't work.
>
> > On Jan 24, 9:53 pm, mdipierro  wrote:
>
> > > I think you want:
>
> > > Field('make',db.car_makers,IS_IN_DB(db,db.car_makers.id,'%(name)s')
>
> > > and
>
> > > db.car.make.default = db(db.car_makers.name=='Ford').select
> > > (db.car_makers.id).first().id
>
> > > On Jan 24, 8:46 pm, weheh  wrote:
>
> > > > I'm certain this has been asked a bunch of times. I've spent the last
> > > > hour looking for it but can't find it anywhere. Sorry.
>
> > > > The question is how to set the default value of a reference field
> > > > based on a query of the referenced table.
>
> > > > db.define_table('car_makers',Field('name',unique=True))
> > > > db.define_table('car',
> > > >   Field('make',db.car_makers,IS_IN_DB(db,'car_makers.name','%(name)
> > > > s')),
> > > >   Field('model'))
>
> > > > I want to set db.car.make.default=db(db.car_makers.name=='Ford').select
> > > > (db.car_makers.id)[0]
> > > > so that when I do an SQLFORM, the drop down list of db.car.make will
> > > > pre-select "Ford".
>
> > > > This isn't working for me. What am I doing wrong?

-- 
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] AJAX with custom widget

2010-01-24 Thread weheh
I'm combining two tables into one form (yet again). I'm using
SQLFORM.factory(db.auth_user,db.table1) to combine the 2 tables into 1
form. All fields have unique names.

I am custom designing the form to make it more compact than the linear
approach used by SQLFORM. Therefore, I end up using
form.custom.begin ... form.custom.widget.fieldname ...
form.custom.end.

One of the widgets is a drop-down list. Based on the value of the drop
down, I want to query the db and get a cost information on the fly and
update the form with this information. Do I need to write a
custom.widget to make this work? How else can I get the AJAX script to
talk to the form?

-- 
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] Re: How to set default value based on query

2010-01-24 Thread mdipierro
how doesn't work?

P.S. you should cache this for speed:

db.car.make.default = db(db.car_makers.name=='Ford').select
(db.car_makers.id,cache=(cache.ram,3600)).first().id

On Jan 24, 9:01 pm, weheh  wrote:
> Sorry. I was writing off the top of my head. Of course, I did exactly
> what you wrote in my actual code. Still doesn't work.
>
> On Jan 24, 9:53 pm, mdipierro  wrote:
>
> > I think you want:
>
> > Field('make',db.car_makers,IS_IN_DB(db,db.car_makers.id,'%(name)s')
>
> > and
>
> > db.car.make.default = db(db.car_makers.name=='Ford').select
> > (db.car_makers.id).first().id
>
> > On Jan 24, 8:46 pm, weheh  wrote:
>
> > > I'm certain this has been asked a bunch of times. I've spent the last
> > > hour looking for it but can't find it anywhere. Sorry.
>
> > > The question is how to set the default value of a reference field
> > > based on a query of the referenced table.
>
> > > db.define_table('car_makers',Field('name',unique=True))
> > > db.define_table('car',
> > >   Field('make',db.car_makers,IS_IN_DB(db,'car_makers.name','%(name)
> > > s')),
> > >   Field('model'))
>
> > > I want to set db.car.make.default=db(db.car_makers.name=='Ford').select
> > > (db.car_makers.id)[0]
> > > so that when I do an SQLFORM, the drop down list of db.car.make will
> > > pre-select "Ford".
>
> > > This isn't working for me. What am I doing wrong?
>
>

-- 
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] Re: How to set default value based on query

2010-01-24 Thread weheh
Sorry. I was writing off the top of my head. Of course, I did exactly
what you wrote in my actual code. Still doesn't work.

On Jan 24, 9:53 pm, mdipierro  wrote:
> I think you want:
>
> Field('make',db.car_makers,IS_IN_DB(db,db.car_makers.id,'%(name)s')
>
> and
>
> db.car.make.default = db(db.car_makers.name=='Ford').select
> (db.car_makers.id).first().id
>
> On Jan 24, 8:46 pm, weheh  wrote:
>
> > I'm certain this has been asked a bunch of times. I've spent the last
> > hour looking for it but can't find it anywhere. Sorry.
>
> > The question is how to set the default value of a reference field
> > based on a query of the referenced table.
>
> > db.define_table('car_makers',Field('name',unique=True))
> > db.define_table('car',
> >   Field('make',db.car_makers,IS_IN_DB(db,'car_makers.name','%(name)
> > s')),
> >   Field('model'))
>
> > I want to set db.car.make.default=db(db.car_makers.name=='Ford').select
> > (db.car_makers.id)[0]
> > so that when I do an SQLFORM, the drop down list of db.car.make will
> > pre-select "Ford".
>
> > This isn't working for me. What am I doing wrong?

-- 
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] Re: How to set default value based on query

2010-01-24 Thread mdipierro
I think you want:

Field('make',db.car_makers,IS_IN_DB(db,db.car_makers.id,'%(name)s')

and

db.car.make.default = db(db.car_makers.name=='Ford').select
(db.car_makers.id).first().id



On Jan 24, 8:46 pm, weheh  wrote:
> I'm certain this has been asked a bunch of times. I've spent the last
> hour looking for it but can't find it anywhere. Sorry.
>
> The question is how to set the default value of a reference field
> based on a query of the referenced table.
>
> db.define_table('car_makers',Field('name',unique=True))
> db.define_table('car',
>   Field('make',db.car_makers,IS_IN_DB(db,'car_makers.name','%(name)
> s')),
>   Field('model'))
>
> I want to set db.car.make.default=db(db.car_makers.name=='Ford').select
> (db.car_makers.id)[0]
> so that when I do an SQLFORM, the drop down list of db.car.make will
> pre-select "Ford".
>
> This isn't working for me. What am I doing wrong?

-- 
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] How to set default value based on query

2010-01-24 Thread weheh
I'm certain this has been asked a bunch of times. I've spent the last
hour looking for it but can't find it anywhere. Sorry.

The question is how to set the default value of a reference field
based on a query of the referenced table.

db.define_table('car_makers',Field('name',unique=True))
db.define_table('car',
  Field('make',db.car_makers,IS_IN_DB(db,'car_makers.name','%(name)
s')),
  Field('model'))

I want to set db.car.make.default=db(db.car_makers.name=='Ford').select
(db.car_makers.id)[0]
so that when I do an SQLFORM, the drop down list of db.car.make will
pre-select "Ford".

This isn't working for me. What am I doing wrong?

-- 
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] Re: no pending patches?

2010-01-24 Thread mdipierro
Can you email me the patch?

On Jan 24, 7:46 pm, Thadeus Burgess  wrote:
> Actually my bad, its not __init__.py it is actually XML() that needs 
> patched...
>
> Just append
>
>             *args,
>             **kwargs
>
> to XML() function definition and it will clear out the error.
>
> WIKI would never work if anybody ever passed anything through
> **attributes since that gets passed to XML.
>
> http://code.google.com/r/thadeusburgess-web2py/source/list?path=/gluo...
>
> Note these two revisions, I prefer args/kwargs since it is more pythonic.
>
> 02cb251533  Fix for WIKI and XML  Dec 16, 2009
>
> 344b561ab8  Fix for WIKI and XML  Dec 16, 2009
>
> -Thadeus
>
> On Sun, Jan 24, 2010 at 7:28 PM, Richard  wrote:
> > """the XML is a patch that Massimo has obviously yet to apply. It is
> > a
> > bug in web2py WIKI helper instead of passing extras to markdown its
> > passing extras to XML which is incorrect, you can look at my google
> > clone of web2py gluon/contrib/markdown/__init__.py for the patch."""
>
> > On Jan 25, 6:45 am, mdipierro  wrote:
> >> Is it possible I have no pending patches?
> >> Am I forgetting something?
>
> >> 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.
>
>

-- 
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] Re: Blogitizor Open Sourced

2010-01-24 Thread Thadeus Burgess
Thanks for making the issues, got to practice using commit to close
the tickets :)

-Thadeus





On Sun, Jan 24, 2010 at 7:48 PM, Thadeus Burgess  wrote:
> Interesting, because HazelCMS is the werkzeug clone of frogcms which
> is the clone of radiantcms.
>
> Funny how the wheel turns round, everyone wants to implement the same
> thing in their own framework i'm sure there is a django clone of
> this as well. I just liked the Admin page layout and felt it was
> suiting.
>
> -Thadeus
>
>
>
>
>
> On Sun, Jan 24, 2010 at 7:43 PM, Richard  wrote:
>> Thanks for taking the effort to extract this from your personal site.
>> Have submitted those issues as tickets.
>>
>> Ah I thought the admin layout seemed familiar - I had been evaluating
>> RadiantCMS (RoR), which FrogCMS is a PHP clone of.
>>
>> Richard
>>
>>
>> On Jan 25, 12:15 pm, Thadeus Burgess  wrote:
>>> And the problem with not adding categories is probably a simple fix in
>>> the SQLFORM requires.
>>>
>>> DO you mind filling out issue tickets on google code for these?
>>>
>>> -Thadeus
>>>
>>>
>>>
>>> On Sun, Jan 24, 2010 at 7:13 PM, Thadeus Burgess  
>>> wrote:
>>> > thadeusb.com is running blogitizor :)
>>>
>>> > the admin panel comes from frogcms.
>>>
>>> > So here is the story, I started this to be my website, so I have a
>>> > theme based around python variables (if you visit my site you will
>>> > quickly see). This is just part of that theme, and these should be
>>> > included in the Configure() settings database at some point. There is
>>> > still alot left to do to add features, and there is still a bit of
>>> > cleanup that needs to be done. So what I did for blogitizor was take
>>> > my website, strip it of as much personal things as I could such as my
>>> > site theme etc etc, and then posted it.
>>>
>>> > oops, my bad on the broken symlinks. The py2jquery I don't even use
>>> > except for a better alternative to response.files. I need to remove
>>> > the dependency for it.
>>>
>>> > the layout.html simlink is because I have several layouts that can be
>>> > used, and it allows to easily switch between them. Since my layout is
>>> > mine I did not want to include it in blogitizor so I had to hack up a
>>> > quick template, I don't like it and might use something like wordpress
>>> > default theme.
>>>
>>> > I don't use localhost for developement, I bind to my PC's ip on the
>>> > router, since I like to be able to fire up my windows box and check
>>> > the site on IE, I suppose its one of those things everyone will need
>>> > to edit for their self, but perhaps a meta is_devel() or PRODUCTION =
>>> > True to be used in the end.
>>>
>>> > thanks for the patches
>>>
>>> > the XML is a patch that Massimo has obviously yet to apply. It is a
>>> > bug in web2py WIKI helper instead of passing extras to markdown its
>>> > passing extras to XML which is incorrect, you can look at my google
>>> > clone of web2py gluon/contrib/markdown/__init__.py for the patch.
>>>
>>> > -Thadeus
>>>
>>> > On Sun, Jan 24, 2010 at 6:13 PM, Richard  wrote:
>>> >> hi Thadeus,
>>>
>>> >> this code has heaps of awesome snippets that will be useful to reuse -
>>> >> thanks for sharing!
>>>
>>> >> I love the black admin layout you've used with the flash message
>>> >> embedded in the top section - do you mind if I reuse it?
>>> >> And do you have a live website using blogitizer?
>>>
>>> >> I noticed a few problems, which I will email to you.
>>>
>>> >> Richard
>>>
>>> >> On Jan 24, 9:48 pm, Thadeus Burgess  wrote:
>>> >>> Ok. So I give it to you, the source of blogitizor. Its not my best
>>> >>> work, but I am limited by the quirks of web applications :(
>>>
>>> >>>http://code.google.com/p/blogitizor/
>>>
>>> >>> There is a install notes and dependencies on the wiki.
>>>
>>> >>> Just some notes to help navigate, I use letters to execute models in
>>> >>> the correct order, I have a class that handles configurations and in
>>> >>> the progress of merging all of the code to use a settings database
>>> >>> where applicable.
>>>
>>> >>> There is also a menumanager class to help handle/render menus.
>>>
>>> >>> Output is automatically compressed when in an production environment.
>>>
>>> >>> models/z_migrate will actually migrate your wordpress over if you have
>>> >>> any, to do this go to admin controller, and imex, then browse for your
>>> >>> wordpress.xml export file, and click wordpress import.
>>>
>>> >>> layout.html is just a softlink to efflorescenetorange, so you might
>>> >>> need to recreate it. I would suggest making your own layout, I don't
>>> >>> like the orange one but was wanting to get this out there at least.
>>>
>>> >>> you will need to install guppy and pygments to use this, hopefully I
>>> >>> can have these optional dependencies instead of required later on.
>>>
>>> >>> If anybody would like to start helping me with this let me know, it
>>> >>> would be awesome if we can get a single official web2py blog, I know a
>>> >>> handful of us are working on ou

Re: [web2py] Re: Blogitizor Open Sourced

2010-01-24 Thread Thadeus Burgess
Interesting, because HazelCMS is the werkzeug clone of frogcms which
is the clone of radiantcms.

Funny how the wheel turns round, everyone wants to implement the same
thing in their own framework i'm sure there is a django clone of
this as well. I just liked the Admin page layout and felt it was
suiting.

-Thadeus





On Sun, Jan 24, 2010 at 7:43 PM, Richard  wrote:
> Thanks for taking the effort to extract this from your personal site.
> Have submitted those issues as tickets.
>
> Ah I thought the admin layout seemed familiar - I had been evaluating
> RadiantCMS (RoR), which FrogCMS is a PHP clone of.
>
> Richard
>
>
> On Jan 25, 12:15 pm, Thadeus Burgess  wrote:
>> And the problem with not adding categories is probably a simple fix in
>> the SQLFORM requires.
>>
>> DO you mind filling out issue tickets on google code for these?
>>
>> -Thadeus
>>
>>
>>
>> On Sun, Jan 24, 2010 at 7:13 PM, Thadeus Burgess  
>> wrote:
>> > thadeusb.com is running blogitizor :)
>>
>> > the admin panel comes from frogcms.
>>
>> > So here is the story, I started this to be my website, so I have a
>> > theme based around python variables (if you visit my site you will
>> > quickly see). This is just part of that theme, and these should be
>> > included in the Configure() settings database at some point. There is
>> > still alot left to do to add features, and there is still a bit of
>> > cleanup that needs to be done. So what I did for blogitizor was take
>> > my website, strip it of as much personal things as I could such as my
>> > site theme etc etc, and then posted it.
>>
>> > oops, my bad on the broken symlinks. The py2jquery I don't even use
>> > except for a better alternative to response.files. I need to remove
>> > the dependency for it.
>>
>> > the layout.html simlink is because I have several layouts that can be
>> > used, and it allows to easily switch between them. Since my layout is
>> > mine I did not want to include it in blogitizor so I had to hack up a
>> > quick template, I don't like it and might use something like wordpress
>> > default theme.
>>
>> > I don't use localhost for developement, I bind to my PC's ip on the
>> > router, since I like to be able to fire up my windows box and check
>> > the site on IE, I suppose its one of those things everyone will need
>> > to edit for their self, but perhaps a meta is_devel() or PRODUCTION =
>> > True to be used in the end.
>>
>> > thanks for the patches
>>
>> > the XML is a patch that Massimo has obviously yet to apply. It is a
>> > bug in web2py WIKI helper instead of passing extras to markdown its
>> > passing extras to XML which is incorrect, you can look at my google
>> > clone of web2py gluon/contrib/markdown/__init__.py for the patch.
>>
>> > -Thadeus
>>
>> > On Sun, Jan 24, 2010 at 6:13 PM, Richard  wrote:
>> >> hi Thadeus,
>>
>> >> this code has heaps of awesome snippets that will be useful to reuse -
>> >> thanks for sharing!
>>
>> >> I love the black admin layout you've used with the flash message
>> >> embedded in the top section - do you mind if I reuse it?
>> >> And do you have a live website using blogitizer?
>>
>> >> I noticed a few problems, which I will email to you.
>>
>> >> Richard
>>
>> >> On Jan 24, 9:48 pm, Thadeus Burgess  wrote:
>> >>> Ok. So I give it to you, the source of blogitizor. Its not my best
>> >>> work, but I am limited by the quirks of web applications :(
>>
>> >>>http://code.google.com/p/blogitizor/
>>
>> >>> There is a install notes and dependencies on the wiki.
>>
>> >>> Just some notes to help navigate, I use letters to execute models in
>> >>> the correct order, I have a class that handles configurations and in
>> >>> the progress of merging all of the code to use a settings database
>> >>> where applicable.
>>
>> >>> There is also a menumanager class to help handle/render menus.
>>
>> >>> Output is automatically compressed when in an production environment.
>>
>> >>> models/z_migrate will actually migrate your wordpress over if you have
>> >>> any, to do this go to admin controller, and imex, then browse for your
>> >>> wordpress.xml export file, and click wordpress import.
>>
>> >>> layout.html is just a softlink to efflorescenetorange, so you might
>> >>> need to recreate it. I would suggest making your own layout, I don't
>> >>> like the orange one but was wanting to get this out there at least.
>>
>> >>> you will need to install guppy and pygments to use this, hopefully I
>> >>> can have these optional dependencies instead of required later on.
>>
>> >>> If anybody would like to start helping me with this let me know, it
>> >>> would be awesome if we can get a single official web2py blog, I know a
>> >>> handful of us are working on our own blog implementations, I think we
>> >>> would really benefit by combining our skills together on one system.
>>
>> >>> Hope yall enjoy the code :)
>>
>> >>> -Thadeus
>>
>> >> --
>> >> You received this message because you are subscribed to the Google Groups 
>> >> "web2py-use

Re: [web2py] Re: no pending patches?

2010-01-24 Thread Thadeus Burgess
Actually my bad, its not __init__.py it is actually XML() that needs patched...

Just append


*args,
**kwargs

to XML() function definition and it will clear out the error.

WIKI would never work if anybody ever passed anything through
**attributes since that gets passed to XML.

http://code.google.com/r/thadeusburgess-web2py/source/list?path=/gluon/html.py&r=6748522e8395427f7bfbc3911b594d0b4df1bb6d

Note these two revisions, I prefer args/kwargs since it is more pythonic.

02cb251533  Fix for WIKI and XML  Dec 16, 2009

344b561ab8  Fix for WIKI and XML  Dec 16, 2009

-Thadeus





On Sun, Jan 24, 2010 at 7:28 PM, Richard  wrote:
> """the XML is a patch that Massimo has obviously yet to apply. It is
> a
> bug in web2py WIKI helper instead of passing extras to markdown its
> passing extras to XML which is incorrect, you can look at my google
> clone of web2py gluon/contrib/markdown/__init__.py for the patch."""
>
>
> On Jan 25, 6:45 am, mdipierro  wrote:
>> Is it possible I have no pending patches?
>> Am I forgetting something?
>>
>> 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.
>
>

-- 
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] Re: Blogitizor Open Sourced

2010-01-24 Thread Richard
Thanks for taking the effort to extract this from your personal site.
Have submitted those issues as tickets.

Ah I thought the admin layout seemed familiar - I had been evaluating
RadiantCMS (RoR), which FrogCMS is a PHP clone of.

Richard


On Jan 25, 12:15 pm, Thadeus Burgess  wrote:
> And the problem with not adding categories is probably a simple fix in
> the SQLFORM requires.
>
> DO you mind filling out issue tickets on google code for these?
>
> -Thadeus
>
>
>
> On Sun, Jan 24, 2010 at 7:13 PM, Thadeus Burgess  
> wrote:
> > thadeusb.com is running blogitizor :)
>
> > the admin panel comes from frogcms.
>
> > So here is the story, I started this to be my website, so I have a
> > theme based around python variables (if you visit my site you will
> > quickly see). This is just part of that theme, and these should be
> > included in the Configure() settings database at some point. There is
> > still alot left to do to add features, and there is still a bit of
> > cleanup that needs to be done. So what I did for blogitizor was take
> > my website, strip it of as much personal things as I could such as my
> > site theme etc etc, and then posted it.
>
> > oops, my bad on the broken symlinks. The py2jquery I don't even use
> > except for a better alternative to response.files. I need to remove
> > the dependency for it.
>
> > the layout.html simlink is because I have several layouts that can be
> > used, and it allows to easily switch between them. Since my layout is
> > mine I did not want to include it in blogitizor so I had to hack up a
> > quick template, I don't like it and might use something like wordpress
> > default theme.
>
> > I don't use localhost for developement, I bind to my PC's ip on the
> > router, since I like to be able to fire up my windows box and check
> > the site on IE, I suppose its one of those things everyone will need
> > to edit for their self, but perhaps a meta is_devel() or PRODUCTION =
> > True to be used in the end.
>
> > thanks for the patches
>
> > the XML is a patch that Massimo has obviously yet to apply. It is a
> > bug in web2py WIKI helper instead of passing extras to markdown its
> > passing extras to XML which is incorrect, you can look at my google
> > clone of web2py gluon/contrib/markdown/__init__.py for the patch.
>
> > -Thadeus
>
> > On Sun, Jan 24, 2010 at 6:13 PM, Richard  wrote:
> >> hi Thadeus,
>
> >> this code has heaps of awesome snippets that will be useful to reuse -
> >> thanks for sharing!
>
> >> I love the black admin layout you've used with the flash message
> >> embedded in the top section - do you mind if I reuse it?
> >> And do you have a live website using blogitizer?
>
> >> I noticed a few problems, which I will email to you.
>
> >> Richard
>
> >> On Jan 24, 9:48 pm, Thadeus Burgess  wrote:
> >>> Ok. So I give it to you, the source of blogitizor. Its not my best
> >>> work, but I am limited by the quirks of web applications :(
>
> >>>http://code.google.com/p/blogitizor/
>
> >>> There is a install notes and dependencies on the wiki.
>
> >>> Just some notes to help navigate, I use letters to execute models in
> >>> the correct order, I have a class that handles configurations and in
> >>> the progress of merging all of the code to use a settings database
> >>> where applicable.
>
> >>> There is also a menumanager class to help handle/render menus.
>
> >>> Output is automatically compressed when in an production environment.
>
> >>> models/z_migrate will actually migrate your wordpress over if you have
> >>> any, to do this go to admin controller, and imex, then browse for your
> >>> wordpress.xml export file, and click wordpress import.
>
> >>> layout.html is just a softlink to efflorescenetorange, so you might
> >>> need to recreate it. I would suggest making your own layout, I don't
> >>> like the orange one but was wanting to get this out there at least.
>
> >>> you will need to install guppy and pygments to use this, hopefully I
> >>> can have these optional dependencies instead of required later on.
>
> >>> If anybody would like to start helping me with this let me know, it
> >>> would be awesome if we can get a single official web2py blog, I know a
> >>> handful of us are working on our own blog implementations, I think we
> >>> would really benefit by combining our skills together on one system.
>
> >>> Hope yall enjoy the code :)
>
> >>> -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 
> >> 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...

[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread John Heenan
On Jan 25, 10:44 am, John Heenan  wrote:
> The __call__ function of the Cache global class instance, cache, is

More confusion busting that is going off topic and should be placed in
a topic of its own that discusses style issues.

For those who are not adjusted to the 'web2py way', the above mention
of 'global class instance' might appear incorrect, impossible or at
the least, 'not the Python way', since no import is implied or
suggested. Globals, as conventionally understood, are frowned upon by
the Python hierarchy, much to the annoyance of those from just about
every other programming environment who work with involved projects. C/
C++ programmers can conventionally tuck away a global namespace with
preprocessor #include statements and files. Python equivalents are not
as straightforward since an import always involves executing a file
(the first time an import on a file is used).

Web2py favours exec over import. The global class instance, cache, is
placed in a dictionary that becomes the environment during an exec.

The line 'environment['cache'] = Cache(request)' appears in the file
compileapp.py.

Hence there is no import.

Ultimately this style leads to more elegance and productivity and
leads to less bugs. How much time is wasted wondering what has been
forgotten to import when coding with Django and irritating compile
errors appear?

John Heenan

-- 
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] missing uploads directory error

2010-01-24 Thread Richard
uploading a file generates an error when the uploads directory does
not exist. Instead of generating an error could web2py just create the
directory?

-- 
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] Re: no pending patches?

2010-01-24 Thread Richard
"""the XML is a patch that Massimo has obviously yet to apply. It is
a
bug in web2py WIKI helper instead of passing extras to markdown its
passing extras to XML which is incorrect, you can look at my google
clone of web2py gluon/contrib/markdown/__init__.py for the patch."""


On Jan 25, 6:45 am, mdipierro  wrote:
> Is it possible I have no pending patches?
> Am I forgetting something?
>
> 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.



Re: [web2py] Re: wysiwyg editor in form does not work with ajax

2010-01-24 Thread Thadeus Burgess
i think the problem is these editors actually replace the textarea so
it does not serialize when you are submitting via ajax.

-Thadeus





On Sun, Jan 24, 2010 at 4:41 PM, selecta  wrote:
> not an option i want wysiwyg, it seems to be possible so i want it
>
> On Jan 23, 5:59 pm, Thadeus Burgess  wrote:
>> Have you ever thought of just using markdown/WIKI syntax and using a
>> markdown editor such as WMD or others like it ?
>>
>> -Thadeus
>>
>>
>>
>> On Sat, Jan 23, 2010 at 6:54 AM, selecta  wrote:
>> > Hi there,
>> > I tried to usehttp://nicedit.com/andhttp://ckeditor.com/demoin my
>> > project. Both work well when the form is submitted normally but both
>> > do not work when the form is submitted via ajax (plug-in). On an ajax
>> > submit the form content of the editor is always empty. Can you give me
>> > assistance on how to make it work.
>> > I could create a test project with that if it would help, but maybe
>> > the answer is simpler, I would also use a different wysiwyg edit (as
>> > long as it looks nice and has enough functions)
>>
>> > so far i found
>> >http://nicedit.com/
>> >http://ckeditor.com/demo
>> >http://jhtmlarea.codeplex.com/
>> >http://avidansoft.com/dsrte/index.php
>> >http://www.upian.com/upiansource/ueditor/en
>> > but i don't want to test them all since i expect that all of them will
>> > have the same problem
>>
>> > Together with the html2makdown python module this would really come in
>> > handy :)
>>
>> > --
>> > 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 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Blogitizor Open Sourced

2010-01-24 Thread Thadeus Burgess
And the problem with not adding categories is probably a simple fix in
the SQLFORM requires.

DO you mind filling out issue tickets on google code for these?

-Thadeus





On Sun, Jan 24, 2010 at 7:13 PM, Thadeus Burgess  wrote:
> thadeusb.com is running blogitizor :)
>
> the admin panel comes from frogcms.
>
> So here is the story, I started this to be my website, so I have a
> theme based around python variables (if you visit my site you will
> quickly see). This is just part of that theme, and these should be
> included in the Configure() settings database at some point. There is
> still alot left to do to add features, and there is still a bit of
> cleanup that needs to be done. So what I did for blogitizor was take
> my website, strip it of as much personal things as I could such as my
> site theme etc etc, and then posted it.
>
> oops, my bad on the broken symlinks. The py2jquery I don't even use
> except for a better alternative to response.files. I need to remove
> the dependency for it.
>
> the layout.html simlink is because I have several layouts that can be
> used, and it allows to easily switch between them. Since my layout is
> mine I did not want to include it in blogitizor so I had to hack up a
> quick template, I don't like it and might use something like wordpress
> default theme.
>
> I don't use localhost for developement, I bind to my PC's ip on the
> router, since I like to be able to fire up my windows box and check
> the site on IE, I suppose its one of those things everyone will need
> to edit for their self, but perhaps a meta is_devel() or PRODUCTION =
> True to be used in the end.
>
> thanks for the patches
>
> the XML is a patch that Massimo has obviously yet to apply. It is a
> bug in web2py WIKI helper instead of passing extras to markdown its
> passing extras to XML which is incorrect, you can look at my google
> clone of web2py gluon/contrib/markdown/__init__.py for the patch.
>
> -Thadeus
>
>
>
>
>
> On Sun, Jan 24, 2010 at 6:13 PM, Richard  wrote:
>> hi Thadeus,
>>
>> this code has heaps of awesome snippets that will be useful to reuse -
>> thanks for sharing!
>>
>> I love the black admin layout you've used with the flash message
>> embedded in the top section - do you mind if I reuse it?
>> And do you have a live website using blogitizer?
>>
>> I noticed a few problems, which I will email to you.
>>
>> Richard
>>
>>
>> On Jan 24, 9:48 pm, Thadeus Burgess  wrote:
>>> Ok. So I give it to you, the source of blogitizor. Its not my best
>>> work, but I am limited by the quirks of web applications :(
>>>
>>> http://code.google.com/p/blogitizor/
>>>
>>> There is a install notes and dependencies on the wiki.
>>>
>>> Just some notes to help navigate, I use letters to execute models in
>>> the correct order, I have a class that handles configurations and in
>>> the progress of merging all of the code to use a settings database
>>> where applicable.
>>>
>>> There is also a menumanager class to help handle/render menus.
>>>
>>> Output is automatically compressed when in an production environment.
>>>
>>> models/z_migrate will actually migrate your wordpress over if you have
>>> any, to do this go to admin controller, and imex, then browse for your
>>> wordpress.xml export file, and click wordpress import.
>>>
>>> layout.html is just a softlink to efflorescenetorange, so you might
>>> need to recreate it. I would suggest making your own layout, I don't
>>> like the orange one but was wanting to get this out there at least.
>>>
>>> you will need to install guppy and pygments to use this, hopefully I
>>> can have these optional dependencies instead of required later on.
>>>
>>> If anybody would like to start helping me with this let me know, it
>>> would be awesome if we can get a single official web2py blog, I know a
>>> handful of us are working on our own blog implementations, I think we
>>> would really benefit by combining our skills together on one system.
>>>
>>> Hope yall enjoy the code :)
>>>
>>> -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.



Re: [web2py] Re: Blogitizor Open Sourced

2010-01-24 Thread Thadeus Burgess
thadeusb.com is running blogitizor :)

the admin panel comes from frogcms.

So here is the story, I started this to be my website, so I have a
theme based around python variables (if you visit my site you will
quickly see). This is just part of that theme, and these should be
included in the Configure() settings database at some point. There is
still alot left to do to add features, and there is still a bit of
cleanup that needs to be done. So what I did for blogitizor was take
my website, strip it of as much personal things as I could such as my
site theme etc etc, and then posted it.

oops, my bad on the broken symlinks. The py2jquery I don't even use
except for a better alternative to response.files. I need to remove
the dependency for it.

the layout.html simlink is because I have several layouts that can be
used, and it allows to easily switch between them. Since my layout is
mine I did not want to include it in blogitizor so I had to hack up a
quick template, I don't like it and might use something like wordpress
default theme.

I don't use localhost for developement, I bind to my PC's ip on the
router, since I like to be able to fire up my windows box and check
the site on IE, I suppose its one of those things everyone will need
to edit for their self, but perhaps a meta is_devel() or PRODUCTION =
True to be used in the end.

thanks for the patches

the XML is a patch that Massimo has obviously yet to apply. It is a
bug in web2py WIKI helper instead of passing extras to markdown its
passing extras to XML which is incorrect, you can look at my google
clone of web2py gluon/contrib/markdown/__init__.py for the patch.

-Thadeus





On Sun, Jan 24, 2010 at 6:13 PM, Richard  wrote:
> hi Thadeus,
>
> this code has heaps of awesome snippets that will be useful to reuse -
> thanks for sharing!
>
> I love the black admin layout you've used with the flash message
> embedded in the top section - do you mind if I reuse it?
> And do you have a live website using blogitizer?
>
> I noticed a few problems, which I will email to you.
>
> Richard
>
>
> On Jan 24, 9:48 pm, Thadeus Burgess  wrote:
>> Ok. So I give it to you, the source of blogitizor. Its not my best
>> work, but I am limited by the quirks of web applications :(
>>
>> http://code.google.com/p/blogitizor/
>>
>> There is a install notes and dependencies on the wiki.
>>
>> Just some notes to help navigate, I use letters to execute models in
>> the correct order, I have a class that handles configurations and in
>> the progress of merging all of the code to use a settings database
>> where applicable.
>>
>> There is also a menumanager class to help handle/render menus.
>>
>> Output is automatically compressed when in an production environment.
>>
>> models/z_migrate will actually migrate your wordpress over if you have
>> any, to do this go to admin controller, and imex, then browse for your
>> wordpress.xml export file, and click wordpress import.
>>
>> layout.html is just a softlink to efflorescenetorange, so you might
>> need to recreate it. I would suggest making your own layout, I don't
>> like the orange one but was wanting to get this out there at least.
>>
>> you will need to install guppy and pygments to use this, hopefully I
>> can have these optional dependencies instead of required later on.
>>
>> If anybody would like to start helping me with this let me know, it
>> would be awesome if we can get a single official web2py blog, I know a
>> handful of us are working on our own blog implementations, I think we
>> would really benefit by combining our skills together on one system.
>>
>> Hope yall enjoy the code :)
>>
>> -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.



[web2py] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread John Heenan
On Jan 25, 2:32 am, mdipierro  wrote:
> I should add that the original Django Proxy also did caching of the
> pages. The one I send you did not. Is this the functionality you need?
> It could be added easily adding
>
> if request.env.request_method=='GET':
>     proxy=cache(request.env.path_info,cache.disk,3600)(proxy)
>

I was confused by this technique at first.

The __call__ function of the Cache global class instance, cache, is
shown used as a decorator on page 113 of the web2py manual (2nd ed).

@cache cannot be used before def proxy since the use of a cache is
conditional on what the request method is (namely GET).

The above usage is just an alternative that modifiies the already
defined proxy function on a per request basis.

John Heenan

-- 
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] Re: Blogitizor Open Sourced

2010-01-24 Thread Richard
hi Thadeus,

this code has heaps of awesome snippets that will be useful to reuse -
thanks for sharing!

I love the black admin layout you've used with the flash message
embedded in the top section - do you mind if I reuse it?
And do you have a live website using blogitizer?

I noticed a few problems, which I will email to you.

Richard


On Jan 24, 9:48 pm, Thadeus Burgess  wrote:
> Ok. So I give it to you, the source of blogitizor. Its not my best
> work, but I am limited by the quirks of web applications :(
>
> http://code.google.com/p/blogitizor/
>
> There is a install notes and dependencies on the wiki.
>
> Just some notes to help navigate, I use letters to execute models in
> the correct order, I have a class that handles configurations and in
> the progress of merging all of the code to use a settings database
> where applicable.
>
> There is also a menumanager class to help handle/render menus.
>
> Output is automatically compressed when in an production environment.
>
> models/z_migrate will actually migrate your wordpress over if you have
> any, to do this go to admin controller, and imex, then browse for your
> wordpress.xml export file, and click wordpress import.
>
> layout.html is just a softlink to efflorescenetorange, so you might
> need to recreate it. I would suggest making your own layout, I don't
> like the orange one but was wanting to get this out there at least.
>
> you will need to install guppy and pygments to use this, hopefully I
> can have these optional dependencies instead of required later on.
>
> If anybody would like to start helping me with this let me know, it
> would be awesome if we can get a single official web2py blog, I know a
> handful of us are working on our own blog implementations, I think we
> would really benefit by combining our skills together on one system.
>
> Hope yall enjoy the code :)
>
> -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] Re: doc fix

2010-01-24 Thread pihentagy
Found a typo in the scribd book, on page (scribd 148) printed 132. The
html helpers list at the bottom of the page, and the next paragraph
contains an innecessary text 5mm. Maybe a wrongly formatted \vspace
argument?

On jan. 24, 21:53, mdipierro  wrote:
> One of them is an error in the docs so I just included it. The other
> two are minor indentation issues so I left them alone.
>
> In general if you just email me patches, I will review and apply them.
>
> Thanks Gergo.
>
> Massimo
>
> On Jan 24, 2:42 pm, "KONTRA, Gergely"  wrote:
>
>
>
> > Hi!
>
> > Please have a look 
> > athttp://code.google.com/r/pihentagy-web2py/source/detail?r=f503c69dee7..
>
> > I am a newbie to mercurial, but how these small bugfixes can go into
> > web2py? Can I request a change to the original web2py repo somehow?
>
> > Thanks
> > Gergo
> > +-[ Gergely Kontra  ]--+
> > |   |
> > | Mobile:(+36 20)356 9656   |
> > |   |
> > +- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+

-- 
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] web2py 1.74.8 is OUT

2010-01-24 Thread mdipierro
#1.74.8
IS_SLUG, thanks Gustavo and Jonathan
web2py.py -nogui, thanks Jeff Bauer
solved a problem with jython, thanks Tim Farrel
login has "remember be option", thanks Piotr Banasziewicz
fixed problem with keepvalue in update forms, thanks Miguel Lopez

Please give it a try and, as usual, report any issues.

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] Re: wysiwyg editor in form does not work with ajax

2010-01-24 Thread selecta
not an option i want wysiwyg, it seems to be possible so i want it

On Jan 23, 5:59 pm, Thadeus Burgess  wrote:
> Have you ever thought of just using markdown/WIKI syntax and using a
> markdown editor such as WMD or others like it ?
>
> -Thadeus
>
>
>
> On Sat, Jan 23, 2010 at 6:54 AM, selecta  wrote:
> > Hi there,
> > I tried to usehttp://nicedit.com/andhttp://ckeditor.com/demoin my
> > project. Both work well when the form is submitted normally but both
> > do not work when the form is submitted via ajax (plug-in). On an ajax
> > submit the form content of the editor is always empty. Can you give me
> > assistance on how to make it work.
> > I could create a test project with that if it would help, but maybe
> > the answer is simpler, I would also use a different wysiwyg edit (as
> > long as it looks nice and has enough functions)
>
> > so far i found
> >http://nicedit.com/
> >http://ckeditor.com/demo
> >http://jhtmlarea.codeplex.com/
> >http://avidansoft.com/dsrte/index.php
> >http://www.upian.com/upiansource/ueditor/en
> > but i don't want to test them all since i expect that all of them will
> > have the same problem
>
> > Together with the html2makdown python module this would really come in
> > handy :)
>
> > --
> > 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] Re: How to change a form according to selected option

2010-01-24 Thread mdipierro
You need to handle this with jQuery.

One can have a single form with all fields you need and use jQuery to
show/hide fields based on values of other fields (*) OR you can have
multiple forms in the page and use jQuery to show/hide an entire form.

The action that generates the forms is executed twice (before the form
is submitted to generate the page, and after the form is submitted)
and therefor it what goes in the form cannot be decided at the web2py
level. Must be done at the client level.

(*) look into kpax views survey. It does that.

On Jan 24, 4:10 pm, oktay  wrote:
> Hi,
>
> What I plan to do is, changing my form in my view according to
> selected option without pushing a button.
> I mean, when I change my option, the form must change. And by default
> first option is selected also... How can I change my below code to
> make it dynamic? Or do you have any suggestions?
>
> Assume I have a select box with options [x,y,z]
>
> def index():
>    values= ['x','y','z']
>    options = (TABLE(FORM(TR('Forms: ', SELECT
> (values,_name='values')
>
>    if request.vars.instrument=='x':
>        form = FORM(INPUT(_name='visitor_name',requires=IS_NOT_EMPTY
> ()),
>                             INPUT(_type='submit'))
>    if request.vars.instrument=='y':
>        form = FORM(INPUT(_name='visitor_name',requires=IS_NOT_EMPTY
> ()),
>                             INPUT
> (_name='visitor_name2',requires=IS_NOT_EMPTY()),
>                             INPUT(_type='submit'))
>   if request.vars.instrument=='z':
>        form = FORM(INPUT(_name='visitor_name2',requires=IS_NOT_EMPTY
> ()),
>                             INPUT
> (_name='visitor_name3',requires=IS_NOT_EMPTY()),
>                             INPUT(_type='submit'))
>
>    return dict(form=form, options=options)
>
> In my view:
> {{extend 'layout.html'}}
> {{=options}}
> {{=form}}
>
> Best wishes...

-- 
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] How to change a form according to selected option

2010-01-24 Thread oktay
Hi,

What I plan to do is, changing my form in my view according to
selected option without pushing a button.
I mean, when I change my option, the form must change. And by default
first option is selected also... How can I change my below code to
make it dynamic? Or do you have any suggestions?

Assume I have a select box with options [x,y,z]

def index():
   values= ['x','y','z']
   options = (TABLE(FORM(TR('Forms: ', SELECT
(values,_name='values')

   if request.vars.instrument=='x':
   form = FORM(INPUT(_name='visitor_name',requires=IS_NOT_EMPTY
()),
INPUT(_type='submit'))
   if request.vars.instrument=='y':
   form = FORM(INPUT(_name='visitor_name',requires=IS_NOT_EMPTY
()),
INPUT
(_name='visitor_name2',requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))
  if request.vars.instrument=='z':
   form = FORM(INPUT(_name='visitor_name2',requires=IS_NOT_EMPTY
()),
INPUT
(_name='visitor_name3',requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))

   return dict(form=form, options=options)

In my view:
{{extend 'layout.html'}}
{{=options}}
{{=form}}

Best wishes...

-- 
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] Re: doc fix

2010-01-24 Thread mdipierro
One of them is an error in the docs so I just included it. The other
two are minor indentation issues so I left them alone.

In general if you just email me patches, I will review and apply them.

Thanks Gergo.


Massimo

On Jan 24, 2:42 pm, "KONTRA, Gergely"  wrote:
> Hi!
>
> Please have a look 
> athttp://code.google.com/r/pihentagy-web2py/source/detail?r=f503c69dee7...http://code.google.com/r/pihentagy-web2py/source/detail?r=230fbcc1f48...
>
> I am a newbie to mercurial, but how these small bugfixes can go into
> web2py? Can I request a change to the original web2py repo somehow?
>
> Thanks
> Gergo
> +-[ Gergely Kontra  ]--+
> |   |
> | Mobile:(+36 20)356 9656   |
> |   |
> +- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+

-- 
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] doc fix

2010-01-24 Thread KONTRA, Gergely
Hi!

Please have a look at
http://code.google.com/r/pihentagy-web2py/source/detail?r=f503c69dee738ebb332e6d25f89328d6910b853f
http://code.google.com/r/pihentagy-web2py/source/detail?r=230fbcc1f488864f868e7dd00e4d9c8b7b41bee3

I am a newbie to mercurial, but how these small bugfixes can go into
web2py? Can I request a change to the original web2py repo somehow?

Thanks
Gergo
+-[ Gergely Kontra  ]--+
|   |
| Mobile:(+36 20)356 9656   |
|   |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+

-- 
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] Re: EOFError?

2010-01-24 Thread vince
oh that's why. thank for the info.

On Jan 25, 3:24 am, mdipierro  wrote:
> You can have a problem with sqlite if you remove a field and you add
> it again with the same name.
>
> This is because sqlite does not support ALTER TABLE ... DROP.
>
> Massimo
>
> On Jan 24, 1:21 pm, vince  wrote:
>
>
>
> > i can't sort out how to reproduce it anyway, it's not happening
> > everytime i add a field. i'll see if the clean up of .table works
>
> > On Jan 25, 2:58 am, vince  wrote:
>
> > > i just did some test and the error seems to appear  when i modify the
> > > table definition, eg add a new field with migrate=true.
> > > it will only appear in the error log and i won't see the actually
> > > error ticket on browsing.
>
> > > On Jan 25, 1:12 am, mdipierro  wrote:
>
> > > > web2py will only recreate them if
>
> > > > a) you also delete the database itself (for sqlite, you must delete
> > > > everything in databases)
>
> > > > OR
>
> > > > b) you know for sure that the current models reflect exactly the
> > > > structure of the database tables and you set "db.define_table
> > > > (...,fake_migrate=True)" for all tables.
>
> > > > In any case. Make a backup of the .tables before you delete them. In
> > > > theory, if you lose them it is always possible to rebuild them (they
> > > > are just picked files.
> > > > Massimo
>
> > > > On Jan 24, 10:54 am, vince  wrote:
>
> > > > > i just double check and it should not be file permission issue.
>
> > > > > is it safe to just delete all .table? web2py will auto recreate them?
>
> > > > > On Jan 25, 12:44 am, mdipierro  wrote:
>
> > > > > > I can only see three possible causes of the problem:
> > > > > > 1) bug in your version of pickle
> > > > > > 2) file permission issue
> > > > > > 3) there are some .table files in you databases folder that were
> > > > > > created by a different python dictribution
>
> > > > > > On Jan 24, 10:16 am, vince  wrote:
>
> > > > > > > i am running from source on linux and mac.
>
> > > > > > > On Jan 23, 6:36 am, mdipierro  wrote:
>
> > > > > > > > Are you using the web2py binary or source?
> > > > > > > > Did you delete only the .table or everything in databases?
> > > > > > > > Does you app run if you set migrate=False for all tables?
>
> > > > > > > > Massimo
>
> > > > > > > > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > > > > > > > Hmm, I've been running into this problem a bunch today. WinXP 
> > > > > > > > > with
> > > > > > > > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > > > > > > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > > > > > > > ~Brian
>
> > > > > > > > > On Jan 22, 2:13 pm, Thadeus Burgess  
> > > > > > > > > wrote:
>
> > > > > > > > > > looks like a corrupted .table file
> > > > > > > > > > -Thadeus
>
> > > > > > > > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  
> > > > > > > > > > wrote:
> > > > > > > > > > > i just look into the error log for some clean up and 
> > > > > > > > > > > found several
> > > > > > > > > > > ticket with the following errors. i am using 1.74.6, any 
> > > > > > > > > > > ideas?
>
> > > > > > > > > > > Traceback (most recent call last):
> > > > > > > > > > >  File 
> > > > > > > > > > > "/Library/WebServer/Documents/web2py/gluon/restricted.py",
> > > > > > > > > > >  line
> > > > > > > > > > > 173, in restricted
> > > > > > > > > > >    exec ccode in environment
> > > > > > > > > > >  File 
> > > > > > > > > > > "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > > > > > > > db.py", line 137, in 
> > > > > > > > > > >    migrate=is_migrate)
> > > > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > > > line 1252,
> > > > > > > > > > > in define_table
> > > > > > > > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > > > line 1703,
> > > > > > > > > > > in _create
> > > > > > > > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > > > > > > > EOFError
>
> > > > > > > > > > > --
> > > > > > > > > > > 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] no pending patches?

2010-01-24 Thread mdipierro
Is it possible I have no pending patches?
Am I forgetting something?

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] Re: EOFError?

2010-01-24 Thread mdipierro
You can have a problem with sqlite if you remove a field and you add
it again with the same name.

This is because sqlite does not support ALTER TABLE ... DROP.

Massimo

On Jan 24, 1:21 pm, vince  wrote:
> i can't sort out how to reproduce it anyway, it's not happening
> everytime i add a field. i'll see if the clean up of .table works
>
> On Jan 25, 2:58 am, vince  wrote:
>
> > i just did some test and the error seems to appear  when i modify the
> > table definition, eg add a new field with migrate=true.
> > it will only appear in the error log and i won't see the actually
> > error ticket on browsing.
>
> > On Jan 25, 1:12 am, mdipierro  wrote:
>
> > > web2py will only recreate them if
>
> > > a) you also delete the database itself (for sqlite, you must delete
> > > everything in databases)
>
> > > OR
>
> > > b) you know for sure that the current models reflect exactly the
> > > structure of the database tables and you set "db.define_table
> > > (...,fake_migrate=True)" for all tables.
>
> > > In any case. Make a backup of the .tables before you delete them. In
> > > theory, if you lose them it is always possible to rebuild them (they
> > > are just picked files.
> > > Massimo
>
> > > On Jan 24, 10:54 am, vince  wrote:
>
> > > > i just double check and it should not be file permission issue.
>
> > > > is it safe to just delete all .table? web2py will auto recreate them?
>
> > > > On Jan 25, 12:44 am, mdipierro  wrote:
>
> > > > > I can only see three possible causes of the problem:
> > > > > 1) bug in your version of pickle
> > > > > 2) file permission issue
> > > > > 3) there are some .table files in you databases folder that were
> > > > > created by a different python dictribution
>
> > > > > On Jan 24, 10:16 am, vince  wrote:
>
> > > > > > i am running from source on linux and mac.
>
> > > > > > On Jan 23, 6:36 am, mdipierro  wrote:
>
> > > > > > > Are you using the web2py binary or source?
> > > > > > > Did you delete only the .table or everything in databases?
> > > > > > > Does you app run if you set migrate=False for all tables?
>
> > > > > > > Massimo
>
> > > > > > > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > > > > > > Hmm, I've been running into this problem a bunch today. WinXP 
> > > > > > > > with
> > > > > > > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > > > > > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > > > > > > ~Brian
>
> > > > > > > > On Jan 22, 2:13 pm, Thadeus Burgess  
> > > > > > > > wrote:
>
> > > > > > > > > looks like a corrupted .table file
> > > > > > > > > -Thadeus
>
> > > > > > > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  
> > > > > > > > > wrote:
> > > > > > > > > > i just look into the error log for some clean up and found 
> > > > > > > > > > several
> > > > > > > > > > ticket with the following errors. i am using 1.74.6, any 
> > > > > > > > > > ideas?
>
> > > > > > > > > > Traceback (most recent call last):
> > > > > > > > > >  File 
> > > > > > > > > > "/Library/WebServer/Documents/web2py/gluon/restricted.py", 
> > > > > > > > > > line
> > > > > > > > > > 173, in restricted
> > > > > > > > > >    exec ccode in environment
> > > > > > > > > >  File 
> > > > > > > > > > "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > > > > > > db.py", line 137, in 
> > > > > > > > > >    migrate=is_migrate)
> > > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > > line 1252,
> > > > > > > > > > in define_table
> > > > > > > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > > line 1703,
> > > > > > > > > > in _create
> > > > > > > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > > > > > > EOFError
>
> > > > > > > > > > --
> > > > > > > > > > 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] Re: EOFError?

2010-01-24 Thread vince
i can't sort out how to reproduce it anyway, it's not happening
everytime i add a field. i'll see if the clean up of .table works


On Jan 25, 2:58 am, vince  wrote:
> i just did some test and the error seems to appear  when i modify the
> table definition, eg add a new field with migrate=true.
> it will only appear in the error log and i won't see the actually
> error ticket on browsing.
>
> On Jan 25, 1:12 am, mdipierro  wrote:
>
>
>
> > web2py will only recreate them if
>
> > a) you also delete the database itself (for sqlite, you must delete
> > everything in databases)
>
> > OR
>
> > b) you know for sure that the current models reflect exactly the
> > structure of the database tables and you set "db.define_table
> > (...,fake_migrate=True)" for all tables.
>
> > In any case. Make a backup of the .tables before you delete them. In
> > theory, if you lose them it is always possible to rebuild them (they
> > are just picked files.
> > Massimo
>
> > On Jan 24, 10:54 am, vince  wrote:
>
> > > i just double check and it should not be file permission issue.
>
> > > is it safe to just delete all .table? web2py will auto recreate them?
>
> > > On Jan 25, 12:44 am, mdipierro  wrote:
>
> > > > I can only see three possible causes of the problem:
> > > > 1) bug in your version of pickle
> > > > 2) file permission issue
> > > > 3) there are some .table files in you databases folder that were
> > > > created by a different python dictribution
>
> > > > On Jan 24, 10:16 am, vince  wrote:
>
> > > > > i am running from source on linux and mac.
>
> > > > > On Jan 23, 6:36 am, mdipierro  wrote:
>
> > > > > > Are you using the web2py binary or source?
> > > > > > Did you delete only the .table or everything in databases?
> > > > > > Does you app run if you set migrate=False for all tables?
>
> > > > > > Massimo
>
> > > > > > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > > > > > Hmm, I've been running into this problem a bunch today. WinXP with
> > > > > > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > > > > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > > > > > ~Brian
>
> > > > > > > On Jan 22, 2:13 pm, Thadeus Burgess  wrote:
>
> > > > > > > > looks like a corrupted .table file
> > > > > > > > -Thadeus
>
> > > > > > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  
> > > > > > > > wrote:
> > > > > > > > > i just look into the error log for some clean up and found 
> > > > > > > > > several
> > > > > > > > > ticket with the following errors. i am using 1.74.6, any 
> > > > > > > > > ideas?
>
> > > > > > > > > Traceback (most recent call last):
> > > > > > > > >  File 
> > > > > > > > > "/Library/WebServer/Documents/web2py/gluon/restricted.py", 
> > > > > > > > > line
> > > > > > > > > 173, in restricted
> > > > > > > > >    exec ccode in environment
> > > > > > > > >  File 
> > > > > > > > > "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > > > > > db.py", line 137, in 
> > > > > > > > >    migrate=is_migrate)
> > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > line 1252,
> > > > > > > > > in define_table
> > > > > > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", 
> > > > > > > > > line 1703,
> > > > > > > > > in _create
> > > > > > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > > > > > EOFError
>
> > > > > > > > > --
> > > > > > > > > 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] Re: urlify

2010-01-24 Thread mdipierro
Jonathan sent me a patch, I merged it with the suggestions above and I
am uploading IS_SLUG to trunk.

Massimo

On Jan 24, 1:09 pm, Thadeus Burgess  wrote:
> I agree with pistacchio.
>
> agree with you massimo on IS_SLUG for filtering only, if you want to
> validate use IS_ALPHANUMERIC.
>
> -Thadeus
>
> On Sun, Jan 24, 2010 at 12:39 PM, Jonathan Lundell  wrote:
> > On Jan 24, 2010, at 9:53 AM, mdipierro wrote:
>
> >> I do not know about this. What do other people think?
> >> I do not have a strong opinion either way.
>
> > I think that slug is a fairly common term. WordPress uses it, for example.
>
> > And if we make it a validator (I'm about to submit a patch), it definitely 
> > can't be IS_URL().
>
> >> On Jan 24, 11:34 am, pistacchio  wrote:
> >>> I'm ok with slugify, but the reason i chose "urlify" is that slug is
> >>> not really a mvc term. It comes from the journalistic jargon and it's
> >>> been adopted by the original Django developers that were working on a
> >>> framework to build a newspaper site on.
>
> >>> I don't think that "slug", outside the Django community, is a standard
> >>> term to name such url-friendly strings. More often they're referred to
> >>> as "pretty urls".
>
> >>> On 24 Gen, 17:55, Jonathan Lundell  wrote:
>
>  On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>
> > I will take a patch. ;-)
>
>  I'll contribute one. Any objection to changing the name to "slugify", 
>  since it's not really urlifying its input?
>
> > On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> >> urlify needs a comment to say explicitly what its intention is. That's 
> >> partly because it suppresses quite a few characters that are normally 
> >> legal in URLs, which is confusing.
>
> >> Also,
>
> >>> def urlify(s, max_length=80):
> >>>     s = s.lower()
> >>>     # string normalization, eg è => e, ñ => n
> >>>     s = unicodedata.normalize('NFKD', 
> >>> s.decode('utf-8')).encode('ASCII', 'ignore')
> >>>     # strip entities
> >>>     s = re.sub('&\w+;', '', s)
>
> >> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string 
> >> like '&whatever&' will be completely eliminated.
>
> >>>     # strip everything but letters, numbers, dashes and spaces
> >>>     s = re.sub('[^a-z0-9\-\s]', '', s)
> >>>     # replace spaces with dashes
> >>>     s = s.replace(' ', '-')
> >>>     # strip multiple contiguous dashes
> >>>     s = re.sub('-{2,}', '-', s)
> >>>     # strip dashes at the beginning and end of the string
> >>>     s = s.strip('-')
> >>>     # ensure the maximum length
> >>>     s = s[:max_length-1]
> >>>     return s
>
> >> (Stylistically, I think it'd be more readable if the comments were 
> >> appended to the relevant code lines.)
>
> > --
> > 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 
> >> 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 
> > 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.



Re: [web2py] Re: urlify

2010-01-24 Thread Jonathan Lundell
On Jan 24, 2010, at 11:05 AM, mdipierro wrote:

> That's a good point.
> 
> I also think the IS_SLUG should not do validation, just filtering. Or
> perhaps have an option to

The patch I sent is filtering-only, sort of a super IS_LOWER().

The main use for it in a form, I think, is to combine IS_SLUG with 
IS_NOT_IN_DB, since slugs want to be unique.


> 
> def IS_SLUG():
>def __init__(check=False,error_message=):
>self.check=check
>self.error_message=error_message
>@staticmethod
>def slugify(value):
>...
>def __call__(self,value):
>if check and not value==self.sugify(value):
>   return (value,self.error_message)
>return (self.slugify(value),None)
> 
> On Jan 24, 12:39 pm, Jonathan Lundell  wrote:
>> On Jan 24, 2010, at 9:53 AM, mdipierro wrote:
>> 
>>> I do not know about this. What do other people think?
>>> I do not have a strong opinion either way.
>> 
>> I think that slug is a fairly common term. WordPress uses it, for example.
>> 
>> And if we make it a validator (I'm about to submit a patch), it definitely 
>> can't be IS_URL().
>> 
>> 
>> 
>>> On Jan 24, 11:34 am, pistacchio  wrote:
 I'm ok with slugify, but the reason i chose "urlify" is that slug is
 not really a mvc term. It comes from the journalistic jargon and it's
 been adopted by the original Django developers that were working on a
 framework to build a newspaper site on.
>> 
 I don't think that "slug", outside the Django community, is a standard
 term to name such url-friendly strings. More often they're referred to
 as "pretty urls".
>> 
 On 24 Gen, 17:55, Jonathan Lundell  wrote:
>> 
> On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>> 
>> I will take a patch. ;-)
>> 
> I'll contribute one. Any objection to changing the name to "slugify", 
> since it's not really urlifying its input?
>> 
>> On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
>>> urlify needs a comment to say explicitly what its intention is. That's 
>>> partly because it suppresses quite a few characters that are normally 
>>> legal in URLs, which is confusing.
>> 
>>> Also,
>> 
 def urlify(s, max_length=80):
 s = s.lower()
 # string normalization, eg è => e, ñ => n
 s = unicodedata.normalize('NFKD', 
 s.decode('utf-8')).encode('ASCII', 'ignore')
 # strip entities
 s = re.sub('&\w+;', '', s)
>> 
>>> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
>>> '&whatever&' will be completely eliminated.
>> 
 # strip everything but letters, numbers, dashes and spaces
 s = re.sub('[^a-z0-9\-\s]', '', s)
 # replace spaces with dashes
 s = s.replace(' ', '-')
 # strip multiple contiguous dashes
 s = re.sub('-{2,}', '-', s)
 # strip dashes at the beginning and end of the string
 s = s.strip('-')
 # ensure the maximum length
 s = s[:max_length-1]
 return s
>> 
>>> (Stylistically, I think it'd be more readable if the comments were 
>>> appended to the relevant code lines.)


-- 
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] Re: urlify

2010-01-24 Thread Thadeus Burgess
I agree with pistacchio.

agree with you massimo on IS_SLUG for filtering only, if you want to
validate use IS_ALPHANUMERIC.

-Thadeus





On Sun, Jan 24, 2010 at 12:39 PM, Jonathan Lundell  wrote:
> On Jan 24, 2010, at 9:53 AM, mdipierro wrote:
>
>> I do not know about this. What do other people think?
>> I do not have a strong opinion either way.
>
> I think that slug is a fairly common term. WordPress uses it, for example.
>
> And if we make it a validator (I'm about to submit a patch), it definitely 
> can't be IS_URL().
>
>>
>> On Jan 24, 11:34 am, pistacchio  wrote:
>>> I'm ok with slugify, but the reason i chose "urlify" is that slug is
>>> not really a mvc term. It comes from the journalistic jargon and it's
>>> been adopted by the original Django developers that were working on a
>>> framework to build a newspaper site on.
>>>
>>> I don't think that "slug", outside the Django community, is a standard
>>> term to name such url-friendly strings. More often they're referred to
>>> as "pretty urls".
>>>
>>> On 24 Gen, 17:55, Jonathan Lundell  wrote:
>>>
 On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>>>
> I will take a patch. ;-)
>>>
 I'll contribute one. Any objection to changing the name to "slugify", 
 since it's not really urlifying its input?
>>>
> On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
>> urlify needs a comment to say explicitly what its intention is. That's 
>> partly because it suppresses quite a few characters that are normally 
>> legal in URLs, which is confusing.
>>>
>> Also,
>>>
>>> def urlify(s, max_length=80):
>>>     s = s.lower()
>>>     # string normalization, eg è => e, ñ => n
>>>     s = unicodedata.normalize('NFKD', 
>>> s.decode('utf-8')).encode('ASCII', 'ignore')
>>>     # strip entities
>>>     s = re.sub('&\w+;', '', s)
>>>
>> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
>> '&whatever&' will be completely eliminated.
>>>
>>>     # strip everything but letters, numbers, dashes and spaces
>>>     s = re.sub('[^a-z0-9\-\s]', '', s)
>>>     # replace spaces with dashes
>>>     s = s.replace(' ', '-')
>>>     # strip multiple contiguous dashes
>>>     s = re.sub('-{2,}', '-', s)
>>>     # strip dashes at the beginning and end of the string
>>>     s = s.strip('-')
>>>     # ensure the maximum length
>>>     s = s[:max_length-1]
>>>     return s
>>>
>> (Stylistically, I think it'd be more readable if the comments were 
>> appended to the relevant code lines.)
>>>
> --
> 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 
> 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] Re: urlify

2010-01-24 Thread mdipierro
That's a good point.

I also think the IS_SLUG should not do validation, just filtering. Or
perhaps have an option to

def IS_SLUG():
def __init__(check=False,error_message=):
self.check=check
self.error_message=error_message
@staticmethod
def slugify(value):
...
def __call__(self,value):
if check and not value==self.sugify(value):
   return (value,self.error_message)
return (self.slugify(value),None)

On Jan 24, 12:39 pm, Jonathan Lundell  wrote:
> On Jan 24, 2010, at 9:53 AM, mdipierro wrote:
>
> > I do not know about this. What do other people think?
> > I do not have a strong opinion either way.
>
> I think that slug is a fairly common term. WordPress uses it, for example.
>
> And if we make it a validator (I'm about to submit a patch), it definitely 
> can't be IS_URL().
>
>
>
> > On Jan 24, 11:34 am, pistacchio  wrote:
> >> I'm ok with slugify, but the reason i chose "urlify" is that slug is
> >> not really a mvc term. It comes from the journalistic jargon and it's
> >> been adopted by the original Django developers that were working on a
> >> framework to build a newspaper site on.
>
> >> I don't think that "slug", outside the Django community, is a standard
> >> term to name such url-friendly strings. More often they're referred to
> >> as "pretty urls".
>
> >> On 24 Gen, 17:55, Jonathan Lundell  wrote:
>
> >>> On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>
>  I will take a patch. ;-)
>
> >>> I'll contribute one. Any objection to changing the name to "slugify", 
> >>> since it's not really urlifying its input?
>
>  On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> > urlify needs a comment to say explicitly what its intention is. That's 
> > partly because it suppresses quite a few characters that are normally 
> > legal in URLs, which is confusing.
>
> > Also,
>
> >> def urlify(s, max_length=80):
> >>     s = s.lower()
> >>     # string normalization, eg è => e, ñ => n
> >>     s = unicodedata.normalize('NFKD', 
> >> s.decode('utf-8')).encode('ASCII', 'ignore')
> >>     # strip entities
> >>     s = re.sub('&\w+;', '', s)
>
> > this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> > '&whatever&' will be completely eliminated.
>
> >>     # strip everything but letters, numbers, dashes and spaces
> >>     s = re.sub('[^a-z0-9\-\s]', '', s)
> >>     # replace spaces with dashes
> >>     s = s.replace(' ', '-')
> >>     # strip multiple contiguous dashes
> >>     s = re.sub('-{2,}', '-', s)
> >>     # strip dashes at the beginning and end of the string
> >>     s = s.strip('-')
> >>     # ensure the maximum length
> >>     s = s[:max_length-1]
> >>     return s
>
> > (Stylistically, I think it'd be more readable if the comments were 
> > appended to the relevant code lines.)
>
>  --
>  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 
> > 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.



Re: [web2py] widgets

2010-01-24 Thread Thadeus Burgess
look in gluon/sqlhtml.py

-Thadeus





On Sun, Jan 24, 2010 at 10:06 AM, leone  wrote:
> Have sameone an example about SQLFORM.widgets.options.widget(...)?
> I am no able to obtain a select-option widget.
> Thanks
> leone
>
> --
> 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] Re: EOFError?

2010-01-24 Thread vince
i just did some test and the error seems to appear  when i modify the
table definition, eg add a new field with migrate=true.
it will only appear in the error log and i won't see the actually
error ticket on browsing.


On Jan 25, 1:12 am, mdipierro  wrote:
> web2py will only recreate them if
>
> a) you also delete the database itself (for sqlite, you must delete
> everything in databases)
>
> OR
>
> b) you know for sure that the current models reflect exactly the
> structure of the database tables and you set "db.define_table
> (...,fake_migrate=True)" for all tables.
>
> In any case. Make a backup of the .tables before you delete them. In
> theory, if you lose them it is always possible to rebuild them (they
> are just picked files.
> Massimo
>
> On Jan 24, 10:54 am, vince  wrote:
>
> > i just double check and it should not be file permission issue.
>
> > is it safe to just delete all .table? web2py will auto recreate them?
>
> > On Jan 25, 12:44 am, mdipierro  wrote:
>
> > > I can only see three possible causes of the problem:
> > > 1) bug in your version of pickle
> > > 2) file permission issue
> > > 3) there are some .table files in you databases folder that were
> > > created by a different python dictribution
>
> > > On Jan 24, 10:16 am, vince  wrote:
>
> > > > i am running from source on linux and mac.
>
> > > > On Jan 23, 6:36 am, mdipierro  wrote:
>
> > > > > Are you using the web2py binary or source?
> > > > > Did you delete only the .table or everything in databases?
> > > > > Does you app run if you set migrate=False for all tables?
>
> > > > > Massimo
>
> > > > > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > > > > Hmm, I've been running into this problem a bunch today. WinXP with
> > > > > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > > > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > > > > ~Brian
>
> > > > > > On Jan 22, 2:13 pm, Thadeus Burgess  wrote:
>
> > > > > > > looks like a corrupted .table file
> > > > > > > -Thadeus
>
> > > > > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  wrote:
> > > > > > > > i just look into the error log for some clean up and found 
> > > > > > > > several
> > > > > > > > ticket with the following errors. i am using 1.74.6, any ideas?
>
> > > > > > > > Traceback (most recent call last):
> > > > > > > >  File 
> > > > > > > > "/Library/WebServer/Documents/web2py/gluon/restricted.py", line
> > > > > > > > 173, in restricted
> > > > > > > >    exec ccode in environment
> > > > > > > >  File 
> > > > > > > > "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > > > > db.py", line 137, in 
> > > > > > > >    migrate=is_migrate)
> > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 
> > > > > > > > 1252,
> > > > > > > > in define_table
> > > > > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 
> > > > > > > > 1703,
> > > > > > > > in _create
> > > > > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > > > > EOFError
>
> > > > > > > > --
> > > > > > > > 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.



Re: [web2py] Re: urlify

2010-01-24 Thread Jonathan Lundell
On Jan 24, 2010, at 9:53 AM, mdipierro wrote:

> I do not know about this. What do other people think?
> I do not have a strong opinion either way.

I think that slug is a fairly common term. WordPress uses it, for example.

And if we make it a validator (I'm about to submit a patch), it definitely 
can't be IS_URL().

> 
> On Jan 24, 11:34 am, pistacchio  wrote:
>> I'm ok with slugify, but the reason i chose "urlify" is that slug is
>> not really a mvc term. It comes from the journalistic jargon and it's
>> been adopted by the original Django developers that were working on a
>> framework to build a newspaper site on.
>> 
>> I don't think that "slug", outside the Django community, is a standard
>> term to name such url-friendly strings. More often they're referred to
>> as "pretty urls".
>> 
>> On 24 Gen, 17:55, Jonathan Lundell  wrote:
>> 
>>> On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>> 
 I will take a patch. ;-)
>> 
>>> I'll contribute one. Any objection to changing the name to "slugify", since 
>>> it's not really urlifying its input?
>> 
 On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> urlify needs a comment to say explicitly what its intention is. That's 
> partly because it suppresses quite a few characters that are normally 
> legal in URLs, which is confusing.
>> 
> Also,
>> 
>> def urlify(s, max_length=80):
>> s = s.lower()
>> # string normalization, eg è => e, ñ => n
>> s = unicodedata.normalize('NFKD', s.decode('utf-8')).encode('ASCII', 
>> 'ignore')
>> # strip entities
>> s = re.sub('&\w+;', '', s)
>> 
> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> '&whatever&' will be completely eliminated.
>> 
>> # strip everything but letters, numbers, dashes and spaces
>> s = re.sub('[^a-z0-9\-\s]', '', s)
>> # replace spaces with dashes
>> s = s.replace(' ', '-')
>> # strip multiple contiguous dashes
>> s = re.sub('-{2,}', '-', s)
>> # strip dashes at the beginning and end of the string
>> s = s.strip('-')
>> # ensure the maximum length
>> s = s[:max_length-1]
>> return s
>> 
> (Stylistically, I think it'd be more readable if the comments were 
> appended to the relevant code lines.)
>> 
 --
 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 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: urlify

2010-01-24 Thread mdipierro
I do not know about this. What do other people think?
I do not have a strong opinion either way.

On Jan 24, 11:34 am, pistacchio  wrote:
> I'm ok with slugify, but the reason i chose "urlify" is that slug is
> not really a mvc term. It comes from the journalistic jargon and it's
> been adopted by the original Django developers that were working on a
> framework to build a newspaper site on.
>
> I don't think that "slug", outside the Django community, is a standard
> term to name such url-friendly strings. More often they're referred to
> as "pretty urls".
>
> On 24 Gen, 17:55, Jonathan Lundell  wrote:
>
> > On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>
> > > I will take a patch. ;-)
>
> > I'll contribute one. Any objection to changing the name to "slugify", since 
> > it's not really urlifying its input?
>
> > > On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> > >> urlify needs a comment to say explicitly what its intention is. That's 
> > >> partly because it suppresses quite a few characters that are normally 
> > >> legal in URLs, which is confusing.
>
> > >> Also,
>
> > >>> def urlify(s, max_length=80):
> > >>>     s = s.lower()
> > >>>     # string normalization, eg è => e, ñ => n
> > >>>     s = unicodedata.normalize('NFKD', 
> > >>> s.decode('utf-8')).encode('ASCII', 'ignore')
> > >>>     # strip entities
> > >>>     s = re.sub('&\w+;', '', s)
>
> > >> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> > >> '&whatever&' will be completely eliminated.
>
> > >>>     # strip everything but letters, numbers, dashes and spaces
> > >>>     s = re.sub('[^a-z0-9\-\s]', '', s)
> > >>>     # replace spaces with dashes
> > >>>     s = s.replace(' ', '-')
> > >>>     # strip multiple contiguous dashes
> > >>>     s = re.sub('-{2,}', '-', s)
> > >>>     # strip dashes at the beginning and end of the string
> > >>>     s = s.strip('-')
> > >>>     # ensure the maximum length
> > >>>     s = s[:max_length-1]
> > >>>     return s
>
> > >> (Stylistically, I think it'd be more readable if the comments were 
> > >> appended to the relevant code lines.)
>
> > > --
> > > 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] Re: urlify

2010-01-24 Thread pistacchio
I'm ok with slugify, but the reason i chose "urlify" is that slug is
not really a mvc term. It comes from the journalistic jargon and it's
been adopted by the original Django developers that were working on a
framework to build a newspaper site on.

I don't think that "slug", outside the Django community, is a standard
term to name such url-friendly strings. More often they're referred to
as "pretty urls".


On 24 Gen, 17:55, Jonathan Lundell  wrote:
> On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>
> > I will take a patch. ;-)
>
> I'll contribute one. Any objection to changing the name to "slugify", since 
> it's not really urlifying its input?
>
>
> > On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> >> urlify needs a comment to say explicitly what its intention is. That's 
> >> partly because it suppresses quite a few characters that are normally 
> >> legal in URLs, which is confusing.
>
> >> Also,
>
> >>> def urlify(s, max_length=80):
> >>>     s = s.lower()
> >>>     # string normalization, eg è => e, ñ => n
> >>>     s = unicodedata.normalize('NFKD', s.decode('utf-8')).encode('ASCII', 
> >>> 'ignore')
> >>>     # strip entities
> >>>     s = re.sub('&\w+;', '', s)
>
> >> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> >> '&whatever&' will be completely eliminated.
>
> >>>     # strip everything but letters, numbers, dashes and spaces
> >>>     s = re.sub('[^a-z0-9\-\s]', '', s)
> >>>     # replace spaces with dashes
> >>>     s = s.replace(' ', '-')
> >>>     # strip multiple contiguous dashes
> >>>     s = re.sub('-{2,}', '-', s)
> >>>     # strip dashes at the beginning and end of the string
> >>>     s = s.strip('-')
> >>>     # ensure the maximum length
> >>>     s = s[:max_length-1]
> >>>     return s
>
> >> (Stylistically, I think it'd be more readable if the comments were 
> >> appended to the relevant code lines.)
>
> > --
> > 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] Re: Group By + Count

2010-01-24 Thread pistacchio
Nevermind, i found it in the book minutes after posting :)

For those interested:
count = db.table.field.count()
result = db().select(db.table.field, count, groupby = db.table.field)


On 24 Gen, 18:22, pistacchio  wrote:
> How to translate the following SQL query in a web2py DAL expression?
> Thanks
>
> SELECT field, count(*) FROM table GROUP BY field

-- 
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] Re: urlify

2010-01-24 Thread Jonathan Lundell
On Jan 24, 2010, at 9:14 AM, mdipierro wrote:

> Since you are at it. We may want to consider a IS_SLUG validator and
> make the function a staticmethod of IS_SLUG (instead of a function in
> contrib) so it can be called without any import from contrib.

OK.

> 
> On Jan 24, 11:12 am, mdipierro  wrote:
>> No objection. It is not in stable it.
>> 
>> On Jan 24, 10:55 am, Jonathan Lundell  wrote:
>> 
>>> On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>> 
 I will take a patch. ;-)
>> 
>>> I'll contribute one. Any objection to changing the name to "slugify", since 
>>> it's not really urlifying its input?
>> 
 On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> urlify needs a comment to say explicitly what its intention is. That's 
> partly because it suppresses quite a few characters that are normally 
> legal in URLs, which is confusing.
>> 
> Also,
>> 
>> def urlify(s, max_length=80):
>> s = s.lower()
>> # string normalization, eg è => e, ñ => n
>> s = unicodedata.normalize('NFKD', s.decode('utf-8')).encode('ASCII', 
>> 'ignore')
>> # strip entities
>> s = re.sub('&\w+;', '', s)
>> 
> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> '&whatever&' will be completely eliminated.
>> 
>> # strip everything but letters, numbers, dashes and spaces
>> s = re.sub('[^a-z0-9\-\s]', '', s)
>> # replace spaces with dashes
>> s = s.replace(' ', '-')
>> # strip multiple contiguous dashes
>> s = re.sub('-{2,}', '-', s)
>> # strip dashes at the beginning and end of the string
>> s = s.strip('-')
>> # ensure the maximum length
>> s = s[:max_length-1]
>> return s
>> 
> (Stylistically, I think it'd be more readable if the comments were 
> appended to the relevant code lines.)
>> 
 --
 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 
http://groups.google.com/group/web2py?hl=en.



[web2py] Group By + Count

2010-01-24 Thread pistacchio
How to translate the following SQL query in a web2py DAL expression?
Thanks

SELECT field, count(*) FROM table GROUP BY field

-- 
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] Re: urlify

2010-01-24 Thread mdipierro
Since you are at it. We may want to consider a IS_SLUG validator and
make the function a staticmethod of IS_SLUG (instead of a function in
contrib) so it can be called without any import from contrib.

On Jan 24, 11:12 am, mdipierro  wrote:
> No objection. It is not in stable it.
>
> On Jan 24, 10:55 am, Jonathan Lundell  wrote:
>
> > On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>
> > > I will take a patch. ;-)
>
> > I'll contribute one. Any objection to changing the name to "slugify", since 
> > it's not really urlifying its input?
>
> > > On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> > >> urlify needs a comment to say explicitly what its intention is. That's 
> > >> partly because it suppresses quite a few characters that are normally 
> > >> legal in URLs, which is confusing.
>
> > >> Also,
>
> > >>> def urlify(s, max_length=80):
> > >>>     s = s.lower()
> > >>>     # string normalization, eg è => e, ñ => n
> > >>>     s = unicodedata.normalize('NFKD', 
> > >>> s.decode('utf-8')).encode('ASCII', 'ignore')
> > >>>     # strip entities
> > >>>     s = re.sub('&\w+;', '', s)
>
> > >> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> > >> '&whatever&' will be completely eliminated.
>
> > >>>     # strip everything but letters, numbers, dashes and spaces
> > >>>     s = re.sub('[^a-z0-9\-\s]', '', s)
> > >>>     # replace spaces with dashes
> > >>>     s = s.replace(' ', '-')
> > >>>     # strip multiple contiguous dashes
> > >>>     s = re.sub('-{2,}', '-', s)
> > >>>     # strip dashes at the beginning and end of the string
> > >>>     s = s.strip('-')
> > >>>     # ensure the maximum length
> > >>>     s = s[:max_length-1]
> > >>>     return s
>
> > >> (Stylistically, I think it'd be more readable if the comments were 
> > >> appended to the relevant code lines.)
>
> > > --
> > > 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] Re: urlify

2010-01-24 Thread mdipierro
No objection. It is not in stable it.

On Jan 24, 10:55 am, Jonathan Lundell  wrote:
> On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>
> > I will take a patch. ;-)
>
> I'll contribute one. Any objection to changing the name to "slugify", since 
> it's not really urlifying its input?
>
>
>
>
>
>
>
> > On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> >> urlify needs a comment to say explicitly what its intention is. That's 
> >> partly because it suppresses quite a few characters that are normally 
> >> legal in URLs, which is confusing.
>
> >> Also,
>
> >>> def urlify(s, max_length=80):
> >>>     s = s.lower()
> >>>     # string normalization, eg è => e, ñ => n
> >>>     s = unicodedata.normalize('NFKD', s.decode('utf-8')).encode('ASCII', 
> >>> 'ignore')
> >>>     # strip entities
> >>>     s = re.sub('&\w+;', '', s)
>
> >> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> >> '&whatever&' will be completely eliminated.
>
> >>>     # strip everything but letters, numbers, dashes and spaces
> >>>     s = re.sub('[^a-z0-9\-\s]', '', s)
> >>>     # replace spaces with dashes
> >>>     s = s.replace(' ', '-')
> >>>     # strip multiple contiguous dashes
> >>>     s = re.sub('-{2,}', '-', s)
> >>>     # strip dashes at the beginning and end of the string
> >>>     s = s.strip('-')
> >>>     # ensure the maximum length
> >>>     s = s[:max_length-1]
> >>>     return s
>
> >> (Stylistically, I think it'd be more readable if the comments were 
> >> appended to the relevant code lines.)
>
> > --
> > 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] Re: EOFError?

2010-01-24 Thread mdipierro
web2py will only recreate them if

a) you also delete the database itself (for sqlite, you must delete
everything in databases)

OR

b) you know for sure that the current models reflect exactly the
structure of the database tables and you set "db.define_table
(...,fake_migrate=True)" for all tables.

In any case. Make a backup of the .tables before you delete them. In
theory, if you lose them it is always possible to rebuild them (they
are just picked files.
Massimo

On Jan 24, 10:54 am, vince  wrote:
> i just double check and it should not be file permission issue.
>
> is it safe to just delete all .table? web2py will auto recreate them?
>
> On Jan 25, 12:44 am, mdipierro  wrote:
>
> > I can only see three possible causes of the problem:
> > 1) bug in your version of pickle
> > 2) file permission issue
> > 3) there are some .table files in you databases folder that were
> > created by a different python dictribution
>
> > On Jan 24, 10:16 am, vince  wrote:
>
> > > i am running from source on linux and mac.
>
> > > On Jan 23, 6:36 am, mdipierro  wrote:
>
> > > > Are you using the web2py binary or source?
> > > > Did you delete only the .table or everything in databases?
> > > > Does you app run if you set migrate=False for all tables?
>
> > > > Massimo
>
> > > > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > > > Hmm, I've been running into this problem a bunch today. WinXP with
> > > > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > > > ~Brian
>
> > > > > On Jan 22, 2:13 pm, Thadeus Burgess  wrote:
>
> > > > > > looks like a corrupted .table file
> > > > > > -Thadeus
>
> > > > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  wrote:
> > > > > > > i just look into the error log for some clean up and found several
> > > > > > > ticket with the following errors. i am using 1.74.6, any ideas?
>
> > > > > > > Traceback (most recent call last):
> > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/restricted.py", 
> > > > > > > line
> > > > > > > 173, in restricted
> > > > > > >    exec ccode in environment
> > > > > > >  File 
> > > > > > > "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > > > db.py", line 137, in 
> > > > > > >    migrate=is_migrate)
> > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 
> > > > > > > 1252,
> > > > > > > in define_table
> > > > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 
> > > > > > > 1703,
> > > > > > > in _create
> > > > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > > > EOFError
>
> > > > > > > --
> > > > > > > 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.



Re: [web2py] Re: urlify

2010-01-24 Thread Jonathan Lundell
On Jan 24, 2010, at 8:30 AM, mdipierro wrote:

> I will take a patch. ;-)

I'll contribute one. Any objection to changing the name to "slugify", since 
it's not really urlifying its input?

> 
> On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
>> urlify needs a comment to say explicitly what its intention is. That's 
>> partly because it suppresses quite a few characters that are normally legal 
>> in URLs, which is confusing.
>> 
>> Also,
>> 
>>> def urlify(s, max_length=80):
>>> s = s.lower()
>>> # string normalization, eg è => e, ñ => n
>>> s = unicodedata.normalize('NFKD', s.decode('utf-8')).encode('ASCII', 
>>> 'ignore')
>>> # strip entities
>>> s = re.sub('&\w+;', '', s)
>> 
>> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
>> '&whatever&' will be completely eliminated.
>> 
>>> # strip everything but letters, numbers, dashes and spaces
>>> s = re.sub('[^a-z0-9\-\s]', '', s)
>>> # replace spaces with dashes
>>> s = s.replace(' ', '-')
>>> # strip multiple contiguous dashes
>>> s = re.sub('-{2,}', '-', s)
>>> # strip dashes at the beginning and end of the string
>>> s = s.strip('-')
>>> # ensure the maximum length
>>> s = s[:max_length-1]
>>> return s
>> 
>> (Stylistically, I think it'd be more readable if the comments were appended 
>> to the relevant code lines.)
> 
> -- 
> 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] Re: EOFError?

2010-01-24 Thread vince
i just double check and it should not be file permission issue.

is it safe to just delete all .table? web2py will auto recreate them?

On Jan 25, 12:44 am, mdipierro  wrote:
> I can only see three possible causes of the problem:
> 1) bug in your version of pickle
> 2) file permission issue
> 3) there are some .table files in you databases folder that were
> created by a different python dictribution
>
> On Jan 24, 10:16 am, vince  wrote:
>
> > i am running from source on linux and mac.
>
> > On Jan 23, 6:36 am, mdipierro  wrote:
>
> > > Are you using the web2py binary or source?
> > > Did you delete only the .table or everything in databases?
> > > Does you app run if you set migrate=False for all tables?
>
> > > Massimo
>
> > > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > > Hmm, I've been running into this problem a bunch today. WinXP with
> > > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > > ~Brian
>
> > > > On Jan 22, 2:13 pm, Thadeus Burgess  wrote:
>
> > > > > looks like a corrupted .table file
> > > > > -Thadeus
>
> > > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  wrote:
> > > > > > i just look into the error log for some clean up and found several
> > > > > > ticket with the following errors. i am using 1.74.6, any ideas?
>
> > > > > > Traceback (most recent call last):
> > > > > >  File "/Library/WebServer/Documents/web2py/gluon/restricted.py", 
> > > > > > line
> > > > > > 173, in restricted
> > > > > >    exec ccode in environment
> > > > > >  File "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > > db.py", line 137, in 
> > > > > >    migrate=is_migrate)
> > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1252,
> > > > > > in define_table
> > > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1703,
> > > > > > in _create
> > > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > > EOFError
>
> > > > > > --
> > > > > > 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] Re: EOFError?

2010-01-24 Thread mdipierro
I can only see three possible causes of the problem:
1) bug in your version of pickle
2) file permission issue
3) there are some .table files in you databases folder that were
created by a different python dictribution

On Jan 24, 10:16 am, vince  wrote:
> i am running from source on linux and mac.
>
> On Jan 23, 6:36 am, mdipierro  wrote:
>
> > Are you using the web2py binary or source?
> > Did you delete only the .table or everything in databases?
> > Does you app run if you set migrate=False for all tables?
>
> > Massimo
>
> > On Jan 22, 4:11 pm, Brian M  wrote:
>
> > > Hmm, I've been running into this problem a bunch today. WinXP with
> > > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > > truncated to 0 bytes for some reason and then web2py chokes.
>
> > > ~Brian
>
> > > On Jan 22, 2:13 pm, Thadeus Burgess  wrote:
>
> > > > looks like a corrupted .table file
> > > > -Thadeus
>
> > > > On Fri, Jan 22, 2010 at 1:18 PM, vince  wrote:
> > > > > i just look into the error log for some clean up and found several
> > > > > ticket with the following errors. i am using 1.74.6, any ideas?
>
> > > > > Traceback (most recent call last):
> > > > >  File "/Library/WebServer/Documents/web2py/gluon/restricted.py", line
> > > > > 173, in restricted
> > > > >    exec ccode in environment
> > > > >  File "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > > db.py", line 137, in 
> > > > >    migrate=is_migrate)
> > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1252,
> > > > > in define_table
> > > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1703,
> > > > > in _create
> > > > >    sql_fields_old = cPickle.load(tfile)
> > > > > EOFError
>
> > > > > --
> > > > > 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] Re: validation problems

2010-01-24 Thread mdipierro
I am interested in the second error:

1) which web2py version?
2) is it producible?
3) can you help me debug it by printing data, type(data) before

  File "/root/workspace/hg/gluon/html.py", line 107, in xmlescape
data = str(data)

Massimo

On Jan 24, 7:30 am, "hamdy.a.farag"  wrote:
> Seems it's a bug
>
> I had that error and that situation repeated
>
> Traceback (most recent call last):
>   File "/hamdy/workspace/hg/gluon/restricted.py", line 173, in
> restricted
>     exec ccode in environment
>   File "/hamdy/workspace/hg/applications/egypttrader/models/a.py",
> line 2, in 
>     T.force('ar-ar')
>   File "/hamdy/workspace/hg/gluon/languages.py", line 148, in force
>     self.t = read_dict(filename)
>   File "/root/workspace/hg/gluon/languages.py", line 44, in read_dict
>     return eval(lang_text)
>   File "", line 3
>     :
> ,
>     ^
> SyntaxError: invalid syntax
>
> --
>
> and I keep having that particular line inserted into my translation
> file
>
> ---
>
> B4 that error I got another one :
>
> Traceback (most recent call last):
>   File "/root/workspace/hg/gluon/restricted.py", line 173, in
> restricted
>     exec ccode in environment
>   File "/root/workspace/hg/applications/egypttrader/views/sysadmin/
> editCompany.html", line 100, in 
>     {{if len(x[key]) != 0:}}
>   File "/root/workspace/hg/gluon/globals.py", line 105, in write
>     self.body.write(xmlescape(data))
>   File "/root/workspace/hg/gluon/html.py", line 107, in xmlescape
>     data = str(data)
> TypeError: __str__ returned non-string (type lazyT)

-- 
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] Re: Determining when a stream has completed sending.

2010-01-24 Thread mdipierro
This should work. Nice idea.

On Jan 24, 5:00 am, jlegler  wrote:
> This is more of a general python question but maybe someone here knows
> if my idea will work or not.  I want my function to tell me when it is
> done running.  Currently I return the stream so there is no obvious
> way to run code after it returns a value.  I am wondering if I do a
> try: finally: statement though if I can call a function as the return
> statement completes.  For instance, the following code returns a
> stream and then in the finally clause, it calls a function called
> complete.  Does anyone know if this is an acceptable practice?
>
> def stream():
>     import os
>     if len(request.args):
>         title_id = int(request.args[0])
>         filename = db(db.content.id == title_id).select()
> [0].filename.replace('.mpi','.mp4')
>         path = os.path.join(request.folder,'static','video',filename)
>         response.headers['ContentType']="video/mp4"
>         try:
>             return response.stream(open(path),chunk_size=4096)
>         finally:
>             complete()
>     else:
>         redirect(URL(request.application,'default','index'))

-- 
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] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread mdipierro
I should add that the original Django Proxy also did caching of the
pages. The one I send you did not. Is this the functionality you need?
It could be added easily adding

if request.env.request_method=='GET':
proxy=cache(request.env.path_info,cache.disk,3600)(proxy)

Massimo

On Jan 23, 6:45 pm, Fran  wrote:
> On Jan 23, 8:55 pm, mdipierro  wrote:
>
> > It is a bit clunky to configure because you have to use routes. You
> > can have multiple controllers to proxy different servers. Similarly to
> > the original Django code it does not carry forward headers from the
> > request. This means range requests, if modified since, streaming, does
> > not work. It is a bit slow.
>
> Well, thanks anyway :)
>
> Seems like this doesn't really do what we wanted anyway...this allows
> us to proxy requests via a proxy server.
> What we wanted was an actual proxy server.
> I must have read the Django app's docs wrong!
>
> Luckily we have a working port of the CGI version...currently very
> basic, but we can build on it :)
>
> Many thanks,
> Fran.

-- 
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] Re: urlify

2010-01-24 Thread mdipierro
I will take a patch. ;-)

On Jan 23, 7:03 pm, Jonathan Lundell  wrote:
> urlify needs a comment to say explicitly what its intention is. That's partly 
> because it suppresses quite a few characters that are normally legal in URLs, 
> which is confusing.
>
> Also,
>
> > def urlify(s, max_length=80):
> >     s = s.lower()
> >     # string normalization, eg è => e, ñ => n
> >     s = unicodedata.normalize('NFKD', s.decode('utf-8')).encode('ASCII', 
> > 'ignore')
> >     # strip entities
> >     s = re.sub('&\w+;', '', s)
>
> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
> '&whatever&' will be completely eliminated.
>
> >     # strip everything but letters, numbers, dashes and spaces
> >     s = re.sub('[^a-z0-9\-\s]', '', s)
> >     # replace spaces with dashes
> >     s = s.replace(' ', '-')
> >     # strip multiple contiguous dashes
> >     s = re.sub('-{2,}', '-', s)
> >     # strip dashes at the beginning and end of the string
> >     s = s.strip('-')
> >     # ensure the maximum length
> >     s = s[:max_length-1]
> >     return s
>
> (Stylistically, I think it'd be more readable if the comments were appended 
> to the relevant code lines.)

-- 
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] Re: One submit for multiple forms. Is it possible?

2010-01-24 Thread mdipierro
Hard to debug but I think something is wrong here..
 $("form").each(function(){
  var submitButton = $(this).find("input[type='submit']");
  $(submitButton).bind("click", function(e){
   ...
   $("form").each(function(i){
   ...

for each form in page, find the submit button and bind to click a
function that (again) loops on each form. Why? The function should
only act on the cuurrent form (this). I do not think there should be
two nested $('form').each(...).

On Jan 23, 9:12 pm, ionel  wrote:
> @massimo
> I have a jQuery solution that show the errors on validation with one
> submit and multiple forms.
> Anyway, I have one problem: for a second POST, despite the modified
> data to post to the server, the second response is identical to the
> first response.
> I don't know if this is a jQuery or a web2py problem. Can you help me,
> please?
>
> Thank you very much.
>
> ionel
>
> 
> $(document).ready(function(){
>  $("form").each(function(){
>   var submitButton = $(this).find("input[type='submit']");
>   $(submitButton).bind("click", function(e){
>    e.preventDefault();
>    $("form").each(function(i){
>     var selected_form = $(this);
>     var data_to_send = selected_form.serialize();
>     //alert(data_to_send);
>     $.ajax({
>      cache: false,
>      type: "POST",
>      //url: "{{=URL(request.application, 'administration', 'members',
> args='add')}}",
>      data: data_to_send,
>      success: function(response){
>       var resp_form = $(response).find("form").eq(i);
>       //  DESPITE MODIFIED data_to_send, A SECOND POST SEND THE
> SAME response 
>       //alert("RESPONSE: \n\n\n:" + resp_form.html());
>       $(selected_form).find("tr").each(function(){
>       if ($(this).attr("id") != "submit_record__row") {
>         var tr_obj = $(this);
>         $(tr_obj).find("td").each(function(){
>         var el_name = $(this).children().attr("name");
>         var element_error = $(resp_form).find("[id='" + el_name +
> "__error']");
>         if (null != element_error) {
>          $(this).children().after(element_error);
>         } else {
>           //TODO: remove the message errors for validated fields
>           $(this).parent().find("[id='" + element_id +
> "__error']").remove();
>         }
>       });
>     }
>    });
>    },
>    error: function(){
>     alert("Error...");
>    }
>  });
>  });
>  });
>  });});
>
> 
>
> On Jan 19, 2:47 pm, Thadeus Burgess  wrote:
>
> > Cant you change it to use SQLFORM.factory instead of crud??
>
> > -Thadeus
>
> > On Tue, Jan 19, 2010 at 7:42 AM, mdipierro  wrote:
> > > The plugin sends one post after the other via ajax. The accept
> > > mechanism should work in this case but I how do you handle errors in
> > > this case?  The JS in the link does not contemplate the possibility
> > > that the posts do not validate.
>
> > > On Jan 19, 5:55 am, ionel  wrote:
> > >> No, because I create the forms with crud from 3 related tables.
>
> > >> I found a jQuery solution 
> > >> at:http://stackoverflow.com/questions/315912/posting-submitting-multiple...
>
> > >> but I'd like to know if web2py itself has a mechanism to do that.
>
> > >> Thank you.
>
> > >> On Jan 18, 11:16 pm, Jason Brower  wrote:
>
> > >> > Couldn't you put all of them under one form?
>
> > >> > On Mon, 2010-01-18 at 19:59 -0800, ionel wrote:
> > >> > > Hello,
>
> > >> > > I have multiple forms (multiple submit buttons) and I need to submit
> > >> > > all forms when I click any submit button.
> > >> > > Is it possible?
>
> > >> > > Thank you.
>
> > >> > > i.a.
>
> > > --
> > > 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] Re: update a form field after validation

2010-01-24 Thread mdipierro
form.accepts(...,onvalidation=lambda form: form.vars.newfield='value')

On Jan 23, 11:56 am, leone  wrote:
> Sorry.
> How can I force a value in a field of SQLFORM.factory after its
> validation?
> Thanks
> leone
>
> On 22 Gen, 20:03, mdipierro  wrote:
>
> > I still do not understand. I want to know what you try to accomplish,
> > not how you do it.
>
> > On Jan 22, 12:38 pm, leone  wrote:
>
> > > Very simple:  IS_AUTONUMBER return an incremental value.
> > > It runs well if I use SQLFORM with a db  linking the validator to a
> > > field before
> > > calling SQLFORM, so I view the value in the form.
> > > But using SQLFORM.factory I obtain the correct value in form.vars
> > > object, but I want
> > > to see it on the screen too and I dont' understand how!
> > > Probably is very simple, but i have no idea ...
> > > Thanks
> > > leone
>
> > > On 22 Gen, 18:34, mdipierro  wrote:
>
> > > > Not sure I understand what this supposed to do. Would you explain it
> > > > once more.
>
> > > > On Jan 22, 10:47 am, leone  wrote:
>
> > > > > I suppose that my error is in setting the new value to field.
> > > > > I am confused.
>
> > > > > def index():
> > > > >     form = SQLFORM.factory (
> > > > >             Field('autonumber','integer', requires=IS_AUTONUMBER
> > > > > (progfile, 1)),
> > > > >             )
> > > > >     def upd_auto(form):
> > > > >         form.custom.autonumber = form.vars.autonumber
> > > > >     if form.accepts(request.vars, session, keepvalues=True,
> > > > > onvalidation=upd_auto):
> > > > >         pass
> > > > >     return dict(form=form)
>
> > > > > Thanks
> > > > > leone
>
> > > > > On 22 Gen, 17:34, DenesL  wrote:
>
> > > > > > Can you post your code?
>
> > > > > > On Jan 22, 11:14 am, leone  wrote:
>
> > > > > > > I done it, but when I update forms.vars. with the new value 
> > > > > > > it is
> > > > > > > not update in the form.
> > > > > > > Have you a suggest?
> > > > > > > leone
>
> > > > > > > On 22 Gen, 17:03, DenesL  wrote:
>
> > > > > > > > If I understand correctly you could use onvalidation.
> > > > > > > > Example:
>
> > > > > > > > def your_action():
>
> > > > > > > >   def funcx():
> > > > > > > >     # code that runs after validation
>
> > > > > > > >   ...
> > > > > > > >   if form.accepts(..., onvalidation=funcx):
> > > > > > > >     ...
>
> > > > > > > > On Jan 22, 10:51 am, leone  wrote:
>
> > > > > > > > > I have a SQLFORM.factory with a Field that requires a custom 
> > > > > > > > > class to
> > > > > > > > > incremet a value.
> > > > > > > > > It runs, but I can't understand how I can udate the field 
> > > > > > > > > value after
> > > > > > > > > form.accepts  and before form is exposed.
> > > > > > > > > Have same example?
> > > > > > > > > Thanks
> > > > > > > > > leone
>
>

-- 
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] Re: EOFError?

2010-01-24 Thread vince
i am running from source on linux and mac.


On Jan 23, 6:36 am, mdipierro  wrote:
> Are you using the web2py binary or source?
> Did you delete only the .table or everything in databases?
> Does you app run if you set migrate=False for all tables?
>
> Massimo
>
> On Jan 22, 4:11 pm, Brian M  wrote:
>
> > Hmm, I've been running into this problem a bunch today. WinXP with
> > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > truncated to 0 bytes for some reason and then web2py chokes.
>
> > ~Brian
>
> > On Jan 22, 2:13 pm, Thadeus Burgess  wrote:
>
> > > looks like a corrupted .table file
> > > -Thadeus
>
> > > On Fri, Jan 22, 2010 at 1:18 PM, vince  wrote:
> > > > i just look into the error log for some clean up and found several
> > > > ticket with the following errors. i am using 1.74.6, any ideas?
>
> > > > Traceback (most recent call last):
> > > >  File "/Library/WebServer/Documents/web2py/gluon/restricted.py", line
> > > > 173, in restricted
> > > >    exec ccode in environment
> > > >  File "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > db.py", line 137, in 
> > > >    migrate=is_migrate)
> > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1252,
> > > > in define_table
> > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1703,
> > > > in _create
> > > >    sql_fields_old = cPickle.load(tfile)
> > > > EOFError
>
> > > > --
> > > > 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] Re: EOFError?

2010-01-24 Thread vince
actually the application is running fine, the weird thing is there are
few error log of this EOFError. i can't figure out when did it occur,
i'll keep you update if i can sort it out.

-vince

On Jan 23, 6:36 am, mdipierro  wrote:
> Are you using the web2py binary or source?
> Did you delete only the .table or everything in databases?
> Does you app run if you set migrate=False for all tables?
>
> Massimo
>
> On Jan 22, 4:11 pm, Brian M  wrote:
>
> > Hmm, I've been running into this problem a bunch today. WinXP with
> > source web2py 1.74.5 and SQLite.  My .table files keep getting
> > truncated to 0 bytes for some reason and then web2py chokes.
>
> > ~Brian
>
> > On Jan 22, 2:13 pm, Thadeus Burgess  wrote:
>
> > > looks like a corrupted .table file
> > > -Thadeus
>
> > > On Fri, Jan 22, 2010 at 1:18 PM, vince  wrote:
> > > > i just look into the error log for some clean up and found several
> > > > ticket with the following errors. i am using 1.74.6, any ideas?
>
> > > > Traceback (most recent call last):
> > > >  File "/Library/WebServer/Documents/web2py/gluon/restricted.py", line
> > > > 173, in restricted
> > > >    exec ccode in environment
> > > >  File "/Library/WebServer/Documents/web2py/applications/cms/models/
> > > > db.py", line 137, in 
> > > >    migrate=is_migrate)
> > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1252,
> > > > in define_table
> > > >    t._create(migrate=migrate, fake_migrate=fake_migrate)
> > > >  File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 1703,
> > > > in _create
> > > >    sql_fields_old = cPickle.load(tfile)
> > > > EOFError
>
> > > > --
> > > > 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] widgets

2010-01-24 Thread leone
Have sameone an example about SQLFORM.widgets.options.widget(...)?
I am no able to obtain a select-option widget.
Thanks
leone

-- 
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] Re: Search frustration

2010-01-24 Thread DenesL

Search results can be improved by using advanced search from the
google groups home page and specifying group web2py, instead of using
search from the group itself.
Note that is also different from the "advanced search" available from
google.

So use this:
http://groups.google.com/groups/advanced_search?safe=off&q=group:web2py

If you remember specific words from the subject of the post or who
made them add them to the filters above the "Advanced Search" button
near the bottom.

I have updated the "help & resources" post with this finding.

Denes.

On Jan 21, 5:08 pm, selecta  wrote:
> i usually use google: site:groups.google.com/group/web2py/ myquery
> but I am not sure if google archives older posts and provides a
> different interface for them
>
> On Jan 21, 10:36 pm, Thadeus Burgess  wrote:
>
> > What are you trying to find ?
>
> > -Thadeus
>
> > On Thu, Jan 21, 2010 at 3:27 PM, DenesL  wrote:
>
> > > Trying to locate older posts in this group using Google, Gmane, Bing,
> > > etc. seems like an exercise in futility. Even with the exact subject
> > > of the post NONE of the above can locate it. Ridiculous.
> > > No wonder some of the questions keep popping up.
> > > Does anybody know of a better way?.
> > > We might need to host this group ourselves.
>
> > > Denes.
>
> > > --
> > > 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] web2py help & resources

2010-01-24 Thread DenesL
Primary source of help: web2py groups
-
http://groups.google.com/group/web2py/topics
http://groups.google.com/group/web2py-developers/topics
http://groups.google.com/group/web2py-users-brazil/topics

Tips on searching the users group
-
The search inside the group does not work very well, use these
instead:
http://groups.google.com/groups/advanced_search?safe=off&q=group:web2py
http://dir.gmane.org/gmane.comp.python.web2py

Resources
-

web site   http://www.web2py.com
docs   http://web2py.com/examples/default/docs (check the links)
DALhttp://web2py.com/examples/default/dal
APIhttp://web2py.com/examples/default/api
examples   http://www.web2py.com/examples/default/examples
auth   http://web2py.com/examples/default/tools
 + CRUD
 + services
Cron   http://web2py.com/examples/default/cron

** all links above also work on your local copy of web2py **

FAQhttp://www.web2py.com/AlterEgo
Wiki   http://wiki.web2py.com
Book 2ed   http://www.lulu.com/content/4968879
 onlinehttp://www.scribd.com/doc/19211452/Web2py-Manual
 erratahttp://wiki.web2py.com/Errata_for_web2py_2nd_Edition_Book
(please update errata if you find more)
Slices http://www.web2pyslices.com/main/default/index
Chat   http://web2pychat.com
Videos http://vimeo.com/videos/search:web2py
Slides http://www.scribd.com/doc/16085263/web2py-slides-version-1644
   http://www.web2py.com/examples/static/pyworks.pdf
   http://www.web2py.com/examples/static/web2py_presentacion_es.pdf
epydocshttp://web2py.com/examples/static/epydoc/index.html
cheatsheet http://www.web2py.com/examples/static/web2py_cheatsheet.pdf
free apps  http://www.web2py.com/appliances

Downloads
-
(Win, Mac, source, latest development)
http://www.web2py.com/examples/default/download

Professional support

http://www.web2py.com/examples/default/support

Running on GAE notes

http://www.futurelogic.com/init/default/wiki/GAEDeploy

Who is using it?

http://appliedstacks.com/NewestFirst/web2py

Pycon 2009 web2py Dojo source code
--
http://www.web2py.com/examples/static/dojo.pdf

-- 
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] Re: form.accepts: get id

2010-01-24 Thread pistacchio
worked, thank you :)

On 24 Gen, 09:59, Thadeus Burgess  wrote:
> form.vars.id
> -Thadeus
>
>
>
> On Sun, Jan 24, 2010 at 2:55 AM, pistacchio  wrote:
> > Hi,
> > once a record has been inserted with form.accepts, how to know the id
> > of that record? Sure, one can performa a select and get the max id,
> > and in most cases this would work, but it's not safe as it *could*
> > happen that another record is inserted in between the time of the
> > insert and the time of the select.
>
> > --
> > 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] Re: SQLFORM: add fields

2010-01-24 Thread pistacchio
thanks, that helped. i was stuck on the "string" representation of it.

On 24 Gen, 14:55, DenesL  wrote:
> Fromhttp://groups.google.com/group/web2py/msg/e6acbb8df0db8e64
>
> 
> any helpers, including a form, is a tree:
>
> form[0] is the table in the form
> form[0][i] is the i-th row
> form[0][i][1] is the 2nd column of the i-th row
> form[0][i][1][0] is the INPUT inside that
> form[0]['_class'] is the class attribute of the table
> form[0][i][1][0]['_name'] is the name attribute of the INPUT
> form.element(_name='email')['_class'] is the class attribute of the
> element with attribute name=='email'
>
> etc.
>
> You can manipulate and change the form structure and form attributes
> in this was any way you want.
> 
>
> form[0], the table, behaves also as a list, so you can insert or
> append to it e.g.:
>
> form[0].insert(TR(...), _id='inserted_table_row')

-- 
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] Re: SQLFORM: add fields

2010-01-24 Thread DenesL

>From http://groups.google.com/group/web2py/msg/e6acbb8df0db8e64


any helpers, including a form, is a tree:

form[0] is the table in the form
form[0][i] is the i-th row
form[0][i][1] is the 2nd column of the i-th row
form[0][i][1][0] is the INPUT inside that
form[0]['_class'] is the class attribute of the table
form[0][i][1][0]['_name'] is the name attribute of the INPUT
form.element(_name='email')['_class'] is the class attribute of the
element with attribute name=='email'

etc.

You can manipulate and change the form structure and form attributes
in this was any way you want.


form[0], the table, behaves also as a list, so you can insert or
append to it e.g.:

form[0].insert(TR(...), _id='inserted_table_row')

-- 
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] Re: validation problems

2010-01-24 Thread hamdy.a.farag
Seems it's a bug

I had that error and that situation repeated

Traceback (most recent call last):
  File "/hamdy/workspace/hg/gluon/restricted.py", line 173, in
restricted
exec ccode in environment
  File "/hamdy/workspace/hg/applications/egypttrader/models/a.py",
line 2, in 
T.force('ar-ar')
  File "/hamdy/workspace/hg/gluon/languages.py", line 148, in force
self.t = read_dict(filename)
  File "/root/workspace/hg/gluon/languages.py", line 44, in read_dict
return eval(lang_text)
  File "", line 3
:
,
^
SyntaxError: invalid syntax


--

and I keep having that particular line inserted into my translation
file

---

B4 that error I got another one :

Traceback (most recent call last):
  File "/root/workspace/hg/gluon/restricted.py", line 173, in
restricted
exec ccode in environment
  File "/root/workspace/hg/applications/egypttrader/views/sysadmin/
editCompany.html", line 100, in 
{{if len(x[key]) != 0:}}
  File "/root/workspace/hg/gluon/globals.py", line 105, in write
self.body.write(xmlescape(data))
  File "/root/workspace/hg/gluon/html.py", line 107, in xmlescape
data = str(data)
TypeError: __str__ returned non-string (type lazyT)

-- 
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] Re: validation problems

2010-01-24 Thread hamdy.a.farag
Hi again

strangely while working I found that this line :

: ,

was pushed into the top of  my translation file "ar-ar.py " so I got
an error , and was fixed by removing this line

I don't know whether it's my mistake or it's something that causes
this situation to happen, but I prefered to tell you that , so that if
there's a code that may cause this
you be aware of

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.



[web2py] Re: downloading to IE& over https

2010-01-24 Thread Anthon
I tried adding:
response.headers['Cache-Control']="private"
return response.stream(pdfContents,chunk_size=4096)

based on this thread: 
http://groups.google.com/group/web2py/browse_thread/thread/8da2043ec17debd6/4ae69758b19ba426

That solves the issue as well, without the need for patching main.py.
I am still in the dark about why
web2py seems to be streaming an HTML reply first...

-- 
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] New features not documented in Book (2nd ed)

2010-01-24 Thread DenesL
New features not documented in Book (2nd edition)

1.74.7
1) request_password_reset and password reset verification
2) python web2py.py -S app -M -R script.py -A arg1 arg2 arg3
3) support for T("%(a)s") % dict(a="hello")
http://groups.google.com/group/web2py/browse_thread/thread/fed8aa7e13d44ab2#

1.74.6
Mostly bug fixes and two main security issues fixed:
* deals with misconfiguration of postgresql that may cause SQL
Injection vulnerability
* blocked accounts were not really blocked
http://groups.google.com/group/web2py/browse_thread/thread/5b60ab4685d33b57#

1.74.5
* auth.user_id (shortcut for auth.user.id, defaults to None if not
logged in)
* support for all native types on GAE (e.g. StringListProperty)
* cache.ram usage statistics
* no more auth menu in scaffolding
* no more splash screen with -Q
* export_to_csv_file has represent
http://groups.google.com/group/web2py/browse_thread/thread/89a718332e6d7115#

1.74.4 - 1.74.2: bug fix releases

LOAD function
  introduced along the plugin system, this went fairly unnoticed
  LOAD(a, b, args=args, vars=vars, ajax=ajax, ajax_trap=ajax_trap )
http://www.web2py.com/AlterEgo/default/show/252

1.74.1
* Moved to mercurial
* Default validators use the new define_table(,format='...')
  http://groups.google.com/group/web2py/browse_thread/thread/35298fa6005a3a5b
* New get_vars and post_vars compatible in 2.5 and 2.6
* Major rewrite of gql.py extends DAL syntax on GAE, supports belongs
  http://groups.google.com/group/web2py/browse_thread/thread/6efa5dd4095f91e1
* No more *.w2p, welcome.w2p is created automatically, base apps are
  always upgraded
* decimal validator allows negative numbers
* last version with the old DAL, the new DAL is in gluon/dal.py
  To try out the new experimental DAL
  copy or rename gluon/dal.py as gluon/sql.py
http://groups.google.com/group/web2py/msg/3e40f3d30c3b82f2

1.73.1
* New decimal field type, as discussed in
 http://groups.google.com/group/web2py/browse_thread/thread/3c1957d8ed743513
* New IS_DECIMAL_IN_RANGE validator
* Experimental support for non UTF8 encoding in DB
* T.current_languages default to 'en' and new T.set_current_languages
* New gluon/contrib/populate.py
* Customizable CSV and more...
http://groups.google.com/group/web2py/browse_thread/thread/72a7d6d43a8aecb1

1.72.1
* Alias for id field
  allows to redefine the name of the 'id' field.
* make_migrate=True
   rebuild missing .table files
http://groups.google.com/group/web2py/browse_thread/thread/eed21229883b5a1a

* keyed tables
  support for legacy tables (MS SQL, DB2, Ingres & Informix)
http://groups.google.com/group/web2py/browse_thread/thread/db150376b06d47fc

1.71.1
* complete rewrite of the Rows object, makes web2py faster and smaller
* DALStorage is renamed Row
* Now you can call web DAL from any Python program
* You can also use the template language from any Python program
http://groups.google.com/group/web2py/browse_thread/thread/159b44bfbb634df2
http://groups.google.com/group/web2py/browse_thread/thread/c81061bc00c6181e

1.69.1
* Lots of new DAL APIs including
  OR, LIKE, BELONGS, and more on GAE
* response.meta.keywords, reponse.meta.description,
  response.meta.author, ...
* response.files.append for including JS & CSS files
* experimental plugin mechanism
http://groups.google.com/group/web2py/browse_thread/thread/fe6381e136995563
http://www.web2py.com/AlterEgo/default/show/248

1.68.1
* New cron
* New hindi and spanish translations
* cached uploads allow for progress bars
* Ingres support
* default setting of content-type (this may cause strange behavior in
  old apps when downloading images)
* IS_UPPER and IS_LOWER work with unicode
* CLEANUP now takes regex of allowed/now allowed characters
* New rewrite.py allows dynamic routes
* Better error messages for IS_INT_* and IS_FLOAT_*
http://groups.google.com/group/web2py/browse_thread/thread/ba5fa43f53ad38ad


Other info
--

How to make your own layouts
http://groups.google.com/group/web2py/browse_thread/thread/6f321414a058b4b3
http://groups.google.com/group/web2py/browse_thread/thread/5a75171b835f542d
http://code.google.com/p/web2py/source/browse/trunk/scripts/layout_make.py

Virtual fields
http://groups.google.com/group/web2py/browse_thread/thread/c684346f13773f93
http://groups.google.com/group/web2py/browse_thread/thread/d59ee3d6c2e6d836
http://www.vimeo.com/7296755
http://www.web2py.com/AlterEgo/default/show/248 (at the end)

-- 
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] Determining when a stream has completed sending.

2010-01-24 Thread jlegler
This is more of a general python question but maybe someone here knows
if my idea will work or not.  I want my function to tell me when it is
done running.  Currently I return the stream so there is no obvious
way to run code after it returns a value.  I am wondering if I do a
try: finally: statement though if I can call a function as the return
statement completes.  For instance, the following code returns a
stream and then in the finally clause, it calls a function called
complete.  Does anyone know if this is an acceptable practice?

def stream():
import os
if len(request.args):
title_id = int(request.args[0])
filename = db(db.content.id == title_id).select()
[0].filename.replace('.mpi','.mp4')
path = os.path.join(request.folder,'static','video',filename)
response.headers['ContentType']="video/mp4"
try:
return response.stream(open(path),chunk_size=4096)
finally:
complete()
else:
redirect(URL(request.application,'default','index'))

-- 
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] Blogitizor Open Sourced

2010-01-24 Thread Thadeus Burgess
Ok. So I give it to you, the source of blogitizor. Its not my best
work, but I am limited by the quirks of web applications :(

http://code.google.com/p/blogitizor/

There is a install notes and dependencies on the wiki.

Just some notes to help navigate, I use letters to execute models in
the correct order, I have a class that handles configurations and in
the progress of merging all of the code to use a settings database
where applicable.

There is also a menumanager class to help handle/render menus.

Output is automatically compressed when in an production environment.

models/z_migrate will actually migrate your wordpress over if you have
any, to do this go to admin controller, and imex, then browse for your
wordpress.xml export file, and click wordpress import.

layout.html is just a softlink to efflorescenetorange, so you might
need to recreate it. I would suggest making your own layout, I don't
like the orange one but was wanting to get this out there at least.

you will need to install guppy and pygments to use this, hopefully I
can have these optional dependencies instead of required later on.

If anybody would like to start helping me with this let me know, it
would be awesome if we can get a single official web2py blog, I know a
handful of us are working on our own blog implementations, I think we
would really benefit by combining our skills together on one system.

Hope yall enjoy the code :)

-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] Re: validation problems

2010-01-24 Thread hamdy.a.farag
it works just fine, thank you :)

I've another thing related to translation though :)
the image upload field has a button  "Choose" / "Browse" depending on
different browsers
Is it possible to have this button translated through the SQLFORM ?

the field also in Google chrome has a value ["Choose a file"] , is it
possible to set this value automatically to what ever string I want
through web2py? the other solution may be trying to replace this field
with another one with the values I want , but It would be easier to
have such a thing in web2py
because It looks strange to have every thing in a language and buttons
like "Browse" in english

-- 
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] Re: 1.74.7 is OUT

2010-01-24 Thread mdipierro
It is just syntactical sugar

T("%(a)s") % dict(a="hello")

is new syntax equivalent to

T("%(a)s",dict(a="hello"))

T could already translated fields and values from your database
(although I would not use it to translate values).


On Jan 24, 12:42 am, Jason Brower  wrote:
> In email...On Sat, 2010-01-23 at 14:03 -0800, mdipierro wrote:
> > New features:
>
> > 1) request_password_reset and password reset verification
> > 2) python web2py.py -S app -M -R script.py -A arg1 arg2 arg3
> > 3) support for T("%(a)s") % dict(a="hello")
>
> What does this one mean?  Does this mean I can translate feilds in my
> database? (if not I would love to know how as I have to translate
> everything in to three languages here in finland. :D)
> BR, Jason
>
>
>
> > I still have a couple of pending patches and I will try to include
> > them during them tomorrow.
>
> > Meanwhile please test this.
>
> > 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] Re: Haiti: Proxy required - Django port? CGI port?

2010-01-24 Thread mdipierro
This is a proxy server (just very limited) and can proxy only one
server.

On Jan 23, 6:45 pm, Fran  wrote:
> On Jan 23, 8:55 pm, mdipierro  wrote:
>
> > It is a bit clunky to configure because you have to use routes. You
> > can have multiple controllers to proxy different servers. Similarly to
> > the original Django code it does not carry forward headers from the
> > request. This means range requests, if modified since, streaming, does
> > not work. It is a bit slow.
>
> Well, thanks anyway :)
>
> Seems like this doesn't really do what we wanted anyway...this allows
> us to proxy requests via a proxy server.
> What we wanted was an actual proxy server.
> I must have read the Django app's docs wrong!
>
> Luckily we have a working port of the CGI version...currently very
> basic, but we can build on it :)
>
> Many thanks,
> Fran.

-- 
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] form.accepts: get id

2010-01-24 Thread Thadeus Burgess
form.vars.id
-Thadeus





On Sun, Jan 24, 2010 at 2:55 AM, pistacchio  wrote:
> Hi,
> once a record has been inserted with form.accepts, how to know the id
> of that record? Sure, one can performa a select and get the max id,
> and in most cases this would work, but it's not safe as it *could*
> happen that another record is inserted in between the time of the
> insert and the time of the select.
>
> --
> 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] form.accepts: get id

2010-01-24 Thread pistacchio
Hi,
once a record has been inserted with form.accepts, how to know the id
of that record? Sure, one can performa a select and get the max id,
and in most cases this would work, but it's not safe as it *could*
happen that another record is inserted in between the time of the
insert and the time of the select.

-- 
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] SQLFORM: add fields

2010-01-24 Thread pistacchio
Hi,
is there a standard way to add fields to a form generate via SQLFORM?
I know I can select which fields to display out of the ones taken from
the database, but what if i want to insert another  field to manage
something in a manual way?

An example is posting a blog entry. Everything generated by SQLFORM is
ok (title, text, image etc), but I need a "tag" field that I'm going
to handle in a different way (i parse it, store the results in a
different table and so on).

Of course i can mess with the generated form (it's a string, at the
end) or, client-side, add it with javascript, but i'm wondering if
there's something more elegant built-in that i missed. 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.