[web2py:19806] Re: dataTables and date

2009-04-15 Thread jmvermeer

Massimo,

I had to add:

T.force('en-nl')

to db.py to get the strings translated.


This introduced the following error:

File "/Library/Python/2.5/site-packages/web2pyfitwise/applications/
core/controllers/eventlist.py", line 25, in byplace
todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
(request.vars.dagen))
TypeError: cannot concatenate 'str' and 'datetime.timedelta' objects


The code in the function reads like:

fromdate=request.vars.datum
todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
(request.vars.dagen))


where, datum refers to the field that has been translated:

SQLField('datum',type='date',requires=[IS_DATE(str(T('%Y-%m-%d'))),
IS_NOT_EMPTY()])


I expected this error to occur:

>> What are the consequences of these two options for these line of code:
>> fromdate=request.vars.datum
> >todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
>> (request.vars.dagen))
>> Here todate should be calculated as: fromdate + days = todate
>> It worked when I used the -MM-DD format, however, now that I
>> changed the format to DD-MM- I expect it to break.


>It will not break. The date as stored by the system is always
>independent by the way you choose to represent it when printed.


I hope you can provide me with a solution to solve this problem.


Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19807] Re: Setting default language

2009-04-15 Thread CK Ng

Is it possible to T.force('en-zh') for SQLFORM label?

def adduser():
form = SQLFORM(db.user)
return dict(form=form)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19808] Re: Issue: sqlite:memory:

2009-04-15 Thread AchipA

Careful with sessions in ram. Your app can go schizophrenic if you
have, say, multiple wsgi processes. Your user would appear to have one
session when going to one of the processes, and another when ending up
on the other wsgi process. The same caveat exists with cache.ram

With the disk-on-app your best bet is fuse anyway, so you can change
the filesystem, but the changes are stored in memory.

On Apr 14, 4:28 am, Iceberg  wrote:
> Thanks Yarko's insight on the topic of db performance domain.
>
> As to me, I brought up the issue only because I want to store sessions
> in RAM. In many cases sessions are not needed to be persistent on
> disk. Ram means maintenance free here, that way there is no need to
> delete old session files anymore. By the way, I personally plan to
> develop an desktop app which will be run on a CD, so the disk is not
> writable at all. Mmm, still a long way to reach that goal, but ram-
> based session will be the first milestone.
>
> So, if only sessions can be put in ram, that is ok for me. If an
> entire db can be fit into ram, that is better because session can be
> stored in this ram db by session.connect(...,db).
>
> On Apr14, 2:17am, Yarko Tymciurak  wrote:
>
> > temporary tables as a performance issue seem reasonable...
> > Solving database storage performance in web2py seems the _wrong_ place to do
> > this.
>
> > Temporary tables (per-request) which help manage web2py's assumption that
> > everything is data-driven, that is so you can take advantage of forms, etc.
> >   seems like a good use of ram-based / "virtual" tables for per-request
> > situations where you want to have the full web2py API at your disposal
> > (validations, forms, etc).
>
> > Temporary (ram-based) tables to address persistent data performance issues
> > should NOT be solved by web2py (if you find some _really compelling_ reason
> > that there is some exceptional case where this makes sense, by all means
> > present your case!  but I don't see anything approaching that right now...)
>
> > Data-presistence performance issues (that is, back end issues) should be the
> > domain of, and solved by the backend.  Some suggestions: Re-structure what
> > you are doing to avoid your specific situation (why are you creating _many_
> > temporary tables???);   select a deb backend that supports temporary tables
> > or other performance concerns that are specific to those you are
> > experiencing (Oracle and T-SQL, Postgres at least support temporary tables).
>
> > IN this regard, it _might_ make sense to have DAL support a "as TEMPORARY"
> >  option for table definiton (as a hint - if the backend supports it, it will
> > use it, otherwise you just get a "normal" table).   I have no idea what the
> > various options and behaviors of temporary tables are, but this (at least)
> > would be in the right direction for web2py
>
> > I'm really not (at this point) for this particular proposal - I would much
> > prefer to see thinking around something more like:
>
> > db.table_create('sometable', .., migrate=Temporary)  # ?  or maybe a
> > separate keyword, but this _does_ seem like a kind of migration issue
>
> > More discussion please!
>
> > - Yarko
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19809] Re: dropbox in form_factory

2009-04-15 Thread jmvermeer

Denes,

> form_factory already gives you the dropbox using the OptionsWidget.
> Do you want something different?.

No, I would like to use the OptionWidget. I had a look at the
OptionsWidget class in gluon/sqlhtml file, but wasn't able to figure
out how to use it in a function.


form=form_factory(SQLField('sleutelwoord',requires=IS_NOT_EMPTY(),\
widget=lambda self, value:INPUT
(_id="='bykeyword',_name='sleutelwoord',_class='OptionsWidget', ...)))


> form=form_factory(
>   SQLField( 'sleutelwoord',requires=IS_IN_DB(...) )
>   ,labels={'sleutelwoord','Selecteer een sleutelwoord'}
>   )
>
> But if you want distinct=True then you have to use IS_IN_SET as in
> your original post.

I had hoped I could resolve this in a handler, like I did for the auto-
complete field.


> BTW, instead of:
> keywordlist=[keywordrows[i]['sleutelwoord'] for i in range(len(keywordrows))]
>
> you can do:
> keywordlist=[k['sleutelwoord'] for k in keywordrows]

That's a lot better than my line of code, when I don't get the widget
to work, I'll do it this way.


Annet.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19810] Re: Poor performance on GAE

2009-04-15 Thread Robin B

I am also not happy with the CGI performance of GAE.

Some interesting numbers:

welcome/default/index:

cold request time: ~1500ms
warm request time: ~150ms  (about 1/10 time of a cold request)

a warm process is reaped in just *60 sec* if there is no activity.

If you have a low activity site, where requests are less frequent than
1/minute then every request will be a cold request (~1.5 sec/request
not including datastore access).

In other words, on low activity sites, byte code caching does not
help, since everything is recompiled on every request...

I wonder if cron can be used to maintain a warm process.  The min cron
interval is 1 minute, so it would be possible to hit a dummy handler
with cron that does nothing just to keep a warm process.

Robin

On Apr 14, 9:23 pm, mdipierro  wrote:
> Whatever you discover please let us know. It will help us improve.
>
> Massimo
>
> On Apr 14, 8:26 pm, Ted G  wrote:
>
> > Thank you for the tips. I'll work through these and determine if I can
> > find a specific root cause of the performance problem.
>
> > I've been testing on a particular page of the application that lists a
> > number of items along with thumbnail images for those items. The
> > thumbnails are images placed into an upload field of the item record
> > and then displayed within the page using the following as the image
> > src:
>
> > {{ =URL(r=request,f='download',args=[channel.image]) }}
>
> > The page itself takes a while to initially respond, and then each
> > thumbnail in turn takes a while to download.
>
> > As a test, I replaced the above image src with the following:
>
> > /img/channel?id={{ =channel.id }}
>
> > and used App.yaml to direct the /img to a request handler using GAE's
> > native wsgihandler where I perform the following to download the
> > thumbnail image instead of using the web2py download():
>
> >             record = channel.get_by_id(int(self.request.get
> > ('id')))
> >             self.response.headers['Content-Type'] = contenttype
> > (record.image)
> >             self.response.out.write(record.image_data)
>
> > While the delay before the page first loads has not changed, the
> > subsequent display of the thumbnails on the page is now very fast
> > (which are the only requests now not being handled by web2py).
>
> > Not sure what to make of this at this point, but I wanted to first
> > ensure there was not a GAE or DB issue before digging deeper into what
> > part of my web2py implementation is slowing things down.
>
> > I have not modified the gaehandler.py and as a first step did move
> > sessions to ram cache instead of db, but have not seen any noticeable
> > performance increase.
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19811] Re: dataTables and date

2009-04-15 Thread mdipierro

This

SQLField('datum',type='date',requires=[IS_DATE(str(T('%Y-%m-
%d'))),IS_NOT_EMPTY()])

 should be

SQLField('datum',type='date',requires=IS_DATE(str(T('%Y-%m-%d'

other than that it is fine.


The main problem is here:

> fromdate=request.vars.datum
> todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int(request.vars.dagen))

since IS_DATE is not being passer the format string so fromdate does
not pass valudation and it id does not it return (fromdate,error)
where fromdate is the original string, hence IS_DATE()(fromdate)[0]
is  string and cannot be concatenated with timedelta. It should be

todate=form.vars.datum+datetime.timedelta(days=int(form.vars.dagen))

executed ONLY is the accept is true (validation passed hence
request.vars.datum is cinverterd to date object and stored in
form.vars.datum)

It depends on the logic, i.e. the order in which those functions are
executed.


On Apr 15, 3:26 am, jmverm...@xs4all.nl wrote:
> Massimo,
>
> I had to add:
>
> T.force('en-nl')
>
> to db.py to get the strings translated.
>
> This introduced the following error:
>
> File "/Library/Python/2.5/site-packages/web2pyfitwise/applications/
> core/controllers/eventlist.py", line 25, in byplace
>     todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> (request.vars.dagen))
> TypeError: cannot concatenate 'str' and 'datetime.timedelta' objects
>
> The code in the function reads like:
>
> fromdate=request.vars.datum
> todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> (request.vars.dagen))
>
> where, datum refers to the field that has been translated:
>
> SQLField('datum',type='date',requires=[IS_DATE(str(T('%Y-%m-%d'))),
> IS_NOT_EMPTY()])
>
> I expected this error to occur:
>
> >> What are the consequences of these two options for these line of code:
> >> fromdate=request.vars.datum
> > >todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> >> (request.vars.dagen))
> >> Here todate should be calculated as: fromdate + days = todate
> >> It worked when I used the -MM-DD format, however, now that I
> >> changed the format to DD-MM- I expect it to break.
> >It will not break. The date as stored by the system is always
> >independent by the way you choose to represent it when printed.
>
> I hope you can provide me with a solution to solve this problem.
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19812] Re: Setting default language

2009-04-15 Thread mdipierro

yes

SQLField(,label=T("whatever"))

On Apr 15, 3:39 am, CK Ng  wrote:
> Is it possible to T.force('en-zh') for SQLFORM label?
>
> def adduser():
>     form = SQLFORM(db.user)
>     return dict(form=form)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19813] Re: Issue: sqlite:memory:

2009-04-15 Thread mdipierro

Yes. that is why we do not have it yet. This is the problem to be
solved

On Apr 15, 3:53 am, AchipA  wrote:
> Careful with sessions in ram. Your app can go schizophrenic if you
> have, say, multiple wsgi processes. Your user would appear to have one
> session when going to one of the processes, and another when ending up
> on the other wsgi process. The same caveat exists with cache.ram
>
> With the disk-on-app your best bet is fuse anyway, so you can change
> the filesystem, but the changes are stored in memory.
>
> On Apr 14, 4:28 am, Iceberg  wrote:
>
> > Thanks Yarko's insight on the topic of db performance domain.
>
> > As to me, I brought up the issue only because I want to store sessions
> > in RAM. In many cases sessions are not needed to be persistent on
> > disk. Ram means maintenance free here, that way there is no need to
> > delete old session files anymore. By the way, I personally plan to
> > develop an desktop app which will be run on a CD, so the disk is not
> > writable at all. Mmm, still a long way to reach that goal, but ram-
> > based session will be the first milestone.
>
> > So, if only sessions can be put in ram, that is ok for me. If an
> > entire db can be fit into ram, that is better because session can be
> > stored in this ram db by session.connect(...,db).
>
> > On Apr14, 2:17am, Yarko Tymciurak  wrote:
>
> > > temporary tables as a performance issue seem reasonable...
> > > Solving database storage performance in web2py seems the _wrong_ place to 
> > > do
> > > this.
>
> > > Temporary tables (per-request) which help manage web2py's assumption that
> > > everything is data-driven, that is so you can take advantage of forms, 
> > > etc.
> > >   seems like a good use of ram-based / "virtual" tables for per-request
> > > situations where you want to have the full web2py API at your disposal
> > > (validations, forms, etc).
>
> > > Temporary (ram-based) tables to address persistent data performance issues
> > > should NOT be solved by web2py (if you find some _really compelling_ 
> > > reason
> > > that there is some exceptional case where this makes sense, by all means
> > > present your case!  but I don't see anything approaching that right 
> > > now...)
>
> > > Data-presistence performance issues (that is, back end issues) should be 
> > > the
> > > domain of, and solved by the backend.  Some suggestions: Re-structure what
> > > you are doing to avoid your specific situation (why are you creating 
> > > _many_
> > > temporary tables???);   select a deb backend that supports temporary 
> > > tables
> > > or other performance concerns that are specific to those you are
> > > experiencing (Oracle and T-SQL, Postgres at least support temporary 
> > > tables).
>
> > > IN this regard, it _might_ make sense to have DAL support a "as TEMPORARY"
> > >  option for table definiton (as a hint - if the backend supports it, it 
> > > will
> > > use it, otherwise you just get a "normal" table).   I have no idea what 
> > > the
> > > various options and behaviors of temporary tables are, but this (at least)
> > > would be in the right direction for web2py
>
> > > I'm really not (at this point) for this particular proposal - I would much
> > > prefer to see thinking around something more like:
>
> > > db.table_create('sometable', .., migrate=Temporary)  # ?  or maybe a
> > > separate keyword, but this _does_ seem like a kind of migration issue
>
> > > More discussion please!
>
> > > - Yarko
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19815] Conditioning IS_IN_DB

2009-04-15 Thread Morten Jeppesen

Hi all

Posted this already - but apparently it did not show - so here we go
again.

I have the following problem (I am a rookie - so forgive me if this is
already explained elsewhere):

db.define_table('country', SQLField('name','string'))

db.define_table('city',
SQLField('country',db.country),
SQLField('name','string'))

db.city.country.requires = IS_IN_DB(db, 'country.id', 'country.name')

db.define_table('tourplan',
SQLField('date', 'date'),
SQLField('country',db.country),
SQLField('city',db.city)
)

db.tourplan.country.requires = IS_IN_DB(db, 'country.id',
'country.name')
#db.tourplan.city.requires = IS_IN_DB(db(db(?), 'city.id',
'city.name') #Not working as intended

What I would like to happen is the following:
Enter some contries in the country table.
Enter some cities in the city table and relate them to their country
Enter a tourplan, by selecting a date, a country (from the dropdown)
and a corresponding city (from the dropdown).

What I would like to happen is that the last city dropdown only shows
the cities that "belongs" to the previously selected country. I just
don't know how to make that happen.

Hope that someone can help. Thank you.
/Morten

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19814] question about db api

2009-04-15 Thread Samit Pal
Hi,

I am a python and web2py newbie. Sorry in advance for the dumb question.

I am trying to use the following code

table=request.vars.table # This gives us the table name to query
query="db.%s.id>0" % (table) # this sets up the query

records=SQLTABLE(db(query).select()) # this should get us records.

But i get the folloeing error.

 File
"/usr/local/google/home/samit/web2py/applications/myapp/controllers/mytestcontroller.py",
line 27, in tracked_in_logs
   records=SQLTABLE(db(query).select())
 File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 1901, in
select
   query = self._select(*fields, **attributes)
 File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 1812, in
_select
   fields = [self._db[table].ALL for table in self._tables]
 File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 435, in
__getitem__
   return dict.__getitem__(self, str(key))
KeyError: 'db'

Is it a problem with getting the value of the variable 'query' not getting
expanded

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19816] Re: question about db api

2009-04-15 Thread mdipierro


You can do this:

query="%s.id>0" % (table)
records=SQLTABLE(db(query).select())

or this:

query=db[table].id>0
records=SQLTABLE(db(query).select())

Notice that in the first case you have quotes so you are writing raw
SQL, hence no db exists (the db connection object is only known to
web2py not the database). I suggest using the second syntax since the
former may be vulnerable to SQL injections.

Massimo



On Apr 15, 4:17 am, Samit Pal  wrote:
> Hi,
>
> I am a python and web2py newbie. Sorry in advance for the dumb question.
>
> I am trying to use the following code
>
> table=request.vars.table # This gives us the table name to query
> query="db.%s.id>0" % (table) # this sets up the query
>
> records=SQLTABLE(db(query).select()) # this should get us records.
>
> But i get the folloeing error.
>
>  File
> "/usr/local/google/home/samit/web2py/applications/myapp/controllers/mytestcontroller.py",
> line 27, in tracked_in_logs
>    records=SQLTABLE(db(query).select())
>  File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 1901, in
> select
>    query = self._select(*fields, **attributes)
>  File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 1812, in
> _select
>    fields = [self._db[table].ALL for table in self._tables]
>  File "/usr/local/google/home/samit/web2py/gluon/sql.py", line 435, in
> __getitem__
>    return dict.__getitem__(self, str(key))
> KeyError: 'db'
>
> Is it a problem with getting the value of the variable 'query' not getting
> expanded
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19817] Re: Conditioning IS_IN_DB

2009-04-15 Thread mdipierro

This cannot be done out of the box. You need to use ajax to make a
part of page dependent on another part of the same page.

assuming you have form=SQLFORM(db.tourplan), the in your HTML you need
something like

$('#tourplan_city').change(function(){ $.ajax(  ) }

and write the  code that sends the city to the server and changes
the content of the select dropbox.

Massimo

On Apr 15, 3:58 am, Morten Jeppesen  wrote:
> Hi all
>
> Posted this already - but apparently it did not show - so here we go
> again.
>
> I have the following problem (I am a rookie - so forgive me if this is
> already explained elsewhere):
>
> db.define_table('country', SQLField('name','string'))
>
> db.define_table('city',
>     SQLField('country',db.country),
>     SQLField('name','string'))
>
> db.city.country.requires = IS_IN_DB(db, 'country.id', 'country.name')
>
> db.define_table('tourplan',
>     SQLField('date', 'date'),
>     SQLField('country',db.country),
>     SQLField('city',db.city)
>     )
>
> db.tourplan.country.requires = IS_IN_DB(db, 'country.id',
> 'country.name')
> #db.tourplan.city.requires = IS_IN_DB(db(db(?), 'city.id',
> 'city.name') #Not working as intended
>
> What I would like to happen is the following:
> Enter some contries in the country table.
> Enter some cities in the city table and relate them to their country
> Enter a tourplan, by selecting a date, a country (from the dropdown)
> and a corresponding city (from the dropdown).
>
> What I would like to happen is that the last city dropdown only shows
> the cities that "belongs" to the previously selected country. I just
> don't know how to make that happen.
>
> Hope that someone can help. Thank you.
> /Morten
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19818] Re: dataTables and date

2009-04-15 Thread jmvermeer

Massimo,


> SQLField('datum',type='date',requires=IS_DATE(str(T('%Y-%m-%d'

I changed this.


> The main problem is here:
>
> > fromdate=request.vars.datum
> > todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int(request.vars.dage 
> > n))


These lines now read like:

fromdate=request.vars.datum
todate=form.vars.datum+datetime.timedelta(days=int(form.vars.dagen))


Exposing the function now results in the following error ticket:

File "/Library/Python/2.5/site-packages/web2pyfitwise/gluon/sql.py",
line 664, in  **b)
DataError: date/time field value out of range: "22-04-2009"
HINT:  Perhaps you need a different "datestyle" setting.


How do I resolve this?


Kind regards,

Annet.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19819] Validation

2009-04-15 Thread annet

In a previous post Massimo corrected the following definition:

SQLField('datum',type='date',requires=[IS_DATE(str(T('%Y-%m-
%d'))),IS_NOT_EMPTY()])


It should be:

SQLField('datum',type='date',requires=IS_DATE(str(T('%Y-%m-
%d'


In this specific case the date field is required, however, I also have
a field of type date which is not required, in this case leaving the
field empty results in the form not passing validation. How do I solve
this problem?


Furthermore, I have fields with an IS_MATCH() validator, does IS_MATCH
() implicate IS_NOT_EMPTY() as well?


Kind regards,

Annet

[IS_MATCH('[1-9]{2}'), IS_NOT_EMPTY()]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19820] Re: Validation

2009-04-15 Thread mdipierro

If required validate it as a date:

SQLField('datum',type='date',requires=IS_DATE(str(T('%Y-%m-%d'

else

SQLField('datum',type='date',requires=IS_NULL_OR(IS_DATE(str(T('%Y-%m-
%d')

Massimo

On Apr 15, 9:30 am, annet  wrote:
> In a previous post Massimo corrected the following definition:
>
> SQLField('datum',type='date',requires=[IS_DATE(str(T('%Y-%m-
> %d'))),IS_NOT_EMPTY()])
>
> It should be:
>
> SQLField('datum',type='date',requires=IS_DATE(str(T('%Y-%m-
> %d'
>
> In this specific case the date field is required, however, I also have
> a field of type date which is not required, in this case leaving the
> field empty results in the form not passing validation. How do I solve
> this problem?
>
> Furthermore, I have fields with an IS_MATCH() validator, does IS_MATCH
> () implicate IS_NOT_EMPTY() as well?
>
> Kind regards,
>
> Annet
>
> [IS_MATCH('[1-9]{2}'), IS_NOT_EMPTY()]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19821] SystemError: NULL result without error in PyObject_Call

2009-04-15 Thread stefan

Hello,

Trying to get web2py to work with mod_wsgi but still no luck.
http://myIP/welcome/default/index shows Internal error and the issued
ticket number/link.

My current setup is:

Apache/2.2.3 (CentOS_x64) DAV/2 mod_wsgi/2.4 Python/2.5.4 PHP/5.1.6
mod_ssl/2.2.3 OpenSSL/0.9.8e-fips-rhel5

Python 2.5.4 was installed from source with:
./configure --with-threads --enable-shared --enable-sqlite3

mod_wsgi was installed from source with:
./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/
python2.5

and declared in httpd.conf:
LoadModule wsgi_module modules/mod_wsgi.so

The command "import sqlite3" in Python shows no error whatsoever.

Apache runs as apache:apache; web2py location is chowned to
apache:web2py.
storage.db is created as expected, but it's size is 0 bytes (is this
normal?).

The vhost settings are:

WSGISocketPrefix run/wsgi
NameVirtualHost *:80

ServerSignature on
ServerName web2py.mydomain.com
DocumentRoot /opt/web2py/applications/

#Alias / /opt/web2py/applications/

WSGIScriptAlias / /opt/web2py/wsgihandler.py
WSGIDaemonProcess web2py user=apache group=web2py \
 home=/opt/web2py/ \
 processes=10 maximum-requests=5000


SSLRequireSSL



SSLRequireSSL


### static files do not need WSGI

Order allow,deny
Allow from all


### everything else goes over WSGI

Order deny,allow
Allow from all
WSGIProcessGroup web2py


LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/000-access-log common

ErrorLog logs/000-error-log
TransferLog logs/000-access-log
LogLevel info



Here is the ticket content:

Traceback (most recent call last):
  File "/opt/wwwlibs/web2py/gluon/restricted.py", line 98, in
restricted
exec ccode in environment
  File "/opt/wwwlibs/web2py/applications/welcome/models/db.py", line
9, in 
db = SQLDB('sqlite://storage.db')  # if not, use SQLite or other
DB
  File "/opt/wwwlibs/web2py/gluon/sql.py", line 649, in __init__
self._pool_connection(lambda : \
  File "/opt/wwwlibs/web2py/gluon/sql.py", line 607, in
_pool_connection
self._connection = f()
  File "/opt/wwwlibs/web2py/gluon/sql.py", line 650, in 
sqlite3.Connection(dbpath))
SystemError: NULL result without error in PyObject_Call


Thank you for your time.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19822] Re: dataTables and date

2009-04-15 Thread mdipierro

can you post the language file?
what database are you using?

Massimo

On Apr 15, 9:10 am, jmverm...@xs4all.nl wrote:
> Massimo,
>
> > SQLField('datum',type='date',requires=IS_DATE(str(T('%Y-%m-%d'
>
> I changed this.
>
> > The main problem is here:
>
> > > fromdate=request.vars.datum
> > > todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int(request.vars.dage
> > >  n))
>
> These lines now read like:
>
> fromdate=request.vars.datum
> todate=form.vars.datum+datetime.timedelta(days=int(form.vars.dagen))
>
> Exposing the function now results in the following error ticket:
>
> File "/Library/Python/2.5/site-packages/web2pyfitwise/gluon/sql.py",
> line 664, in  **b)
> DataError: date/time field value out of range: "22-04-2009"
> HINT:  Perhaps you need a different "datestyle" setting.
>
> How do I resolve this?
>
> Kind regards,
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19823] Re: SystemError: NULL result without error in PyObject_Call

2009-04-15 Thread mdipierro

Follow this thread...

http://www.modpython.org/pipermail/mod_python/2008-December/025871.html

They have a solution. It is not a web2py problem.

Massimo

On Apr 15, 9:33 am, stefan  wrote:
> Hello,
>
> Trying to get web2py to work with mod_wsgi but still no 
> luck.http://myIP/welcome/default/indexshows Internal error and the issued
> ticket number/link.
>
> My current setup is:
>
> Apache/2.2.3 (CentOS_x64) DAV/2 mod_wsgi/2.4 Python/2.5.4 PHP/5.1.6
> mod_ssl/2.2.3 OpenSSL/0.9.8e-fips-rhel5
>
> Python 2.5.4 was installed from source with:
> ./configure --with-threads --enable-shared --enable-sqlite3
>
> mod_wsgi was installed from source with:
> ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/
> python2.5
>
> and declared in httpd.conf:
> LoadModule wsgi_module modules/mod_wsgi.so
>
> The command "import sqlite3" in Python shows no error whatsoever.
>
> Apache runs as apache:apache; web2py location is chowned to
> apache:web2py.
> storage.db is created as expected, but it's size is 0 bytes (is this
> normal?).
>
> The vhost settings are:
>
> WSGISocketPrefix run/wsgi
> NameVirtualHost *:80
> 
>         ServerSignature on
>         ServerName web2py.mydomain.com
>         DocumentRoot /opt/web2py/applications/
>
>         #Alias / /opt/web2py/applications/
>
>         WSGIScriptAlias / /opt/web2py/wsgihandler.py
>         WSGIDaemonProcess web2py user=apache group=web2py \
>          home=/opt/web2py/ \
>          processes=10 maximum-requests=5000
>
>         
>                 SSLRequireSSL
>         
>
>         
>                 SSLRequireSSL
>         
>
>         ### static files do not need WSGI
>         
>                 Order allow,deny
>                 Allow from all
>         
>
>         ### everything else goes over WSGI
>         
>                 Order deny,allow
>                 Allow from all
>                 WSGIProcessGroup web2py
>         
>
>         LogFormat "%h %l %u %t \"%r\" %>s %b" common
>         CustomLog logs/000-access-log common
>
>         ErrorLog logs/000-error-log
>         TransferLog logs/000-access-log
>         LogLevel info
> 
>
> Here is the ticket content:
>
> Traceback (most recent call last):
>   File "/opt/wwwlibs/web2py/gluon/restricted.py", line 98, in
> restricted
>     exec ccode in environment
>   File "/opt/wwwlibs/web2py/applications/welcome/models/db.py", line
> 9, in 
>     db = SQLDB('sqlite://storage.db')  # if not, use SQLite or other
> DB
>   File "/opt/wwwlibs/web2py/gluon/sql.py", line 649, in __init__
>     self._pool_connection(lambda : \
>   File "/opt/wwwlibs/web2py/gluon/sql.py", line 607, in
> _pool_connection
>     self._connection = f()
>   File "/opt/wwwlibs/web2py/gluon/sql.py", line 650, in 
>     sqlite3.Connection(dbpath))
> SystemError: NULL result without error in PyObject_Call
>
> Thank you for your time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19824] Re: SystemError: NULL result without error in PyObject_Call

2009-04-15 Thread stefan

Thank you very much.
Indeed, mod_mem_cache was the problem.
Once disabled, the page loaded as expected.

Thank you.

On 15 Apr, 18:06, mdipierro  wrote:
> Follow this thread...
>
> http://www.modpython.org/pipermail/mod_python/2008-December/025871.html
>
> They have a solution. It is not a web2py problem.
>
> Massimo
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19825] Re: SystemError: NULL result without error in PyObject_Call

2009-04-15 Thread mdipierro

Thanks for letting us know. I am sure others will find the information
useful.
This type of wsgi issues are a mistery to me.

Massimo

On Apr 15, 10:16 am, stefan  wrote:
> Thank you very much.
> Indeed, mod_mem_cache was the problem.
> Once disabled, the page loaded as expected.
>
> Thank you.
>
> On 15 Apr, 18:06, mdipierro  wrote:
>
> > Follow this thread...
>
> >http://www.modpython.org/pipermail/mod_python/2008-December/025871.html
>
> > They have a solution. It is not a web2py problem.
>
> > Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19826] Re: RFC auto fields

2009-04-15 Thread Yarko Tymciurak
Hi Massimo -
I will be at choir tonight (it's a "in one house" rehearsal w/ several
choirs) and go to Poor Phils, but I will need to ride home tonight (Joan
wanted "a break, with no phone calls" -- I have no idea what is going on...)
I have been tired / exhausted this past month, so I will not stay late.

Hope to see you!

Regards,
Yarko
847-668-8985 (cell phone)

On Tue, Apr 14, 2009 at 9:26 PM, mdipierro  wrote:

>
> I have been thinking about this. Even if I do not like your proposal
> Yarko, I think you have a better point than you think. In fact
> form_factory would not work with my proposal syntax but it would work
> with yours and that is a big plus in your favor.
>
> I am tired so I think I am going to sleep on this.
>
> Massimo
>
> On Apr 14, 12:23 pm, Yarko Tymciurak  wrote:
> > On Tue, Apr 14, 2009 at 11:18 AM, mdipierro 
> wrote:
> >
> > > but the user can already define its own
> >
> > >   parse(text)
> >
> > > and use it
> >
> > >   db.define_table(*parse(text))
> >
> > H not pre-this discussion.  Anyway, if you are talking about
> parsing
> > to create one string so that your chosen solution is in gluon, then
> > technically you are right.  More to the point, you can NOW do this -
> parse a
> > single string to create the equivalent SQLField calls for define_table()!
> >
> > > I am talking about *forcing* a new syntax to our users instead of
> > > having everybody come up with their own shortcuts.
> >
> > ugh!
> >
> > We are talking about the same thing - only I want per-field syntax to be
> > defined, and you want per-table - at the gluon level, this is  the only
> > difference.
> >
> > Per table, I argue, is too brittle, over-specified;  I argue that
> per-field
> > is the natural choice for this;  you disagree.
> >
> > IF you really want to "force" this ("no choice"), then you do you want to
> > drop SQLField and db.Field too?
> >
> > > The solution I propose introduce a simpler syntax to define tables and
> > > set defaults.
> >
> > No difference in simplicity between what you suggest (per table) and what
> I
> > suggest (per field tokens);  in fact, I think per-field is simpler for a
> > broader range of uses - you see this simplest for your intended use, but
> I
> > argue it will narrow the scope of uses (what I mean by "brittle").
> >
> >
> >
> > >  db.define_table('dog: name unique, owner person by name')
> >
> > One parser for tables - more complex, more difficult to define and
> explain,
> > more difficult to validate, more difficult to change / extend (too
> coupled
> > of a design - and I don't see any compelling reason!)  --- for me this is
> a
> > strong consideration.  Perhaps you have defined a grammar to show that it
> is
> > extensible, maintainable.  In such case, my concerns become weaker.
> >
> > > The solution you propose allows users to do
> >
> > >  db.define_table('dog', 'name unique', 'owner person by name')
> >
> > Yes - and ONLY this!
> >
> > >  db.define_table(parse('dog: name unique, owner person by name'))
> >
> > Massimo - you are fishing for arguments, but your fishing hook still has
> > only a worm on it!  :-) You can do this now - you are right, no reason
> you
> > cannot parse this string into a sequence of appropriate db.Field() calls
> > now.
> >
> > >  db.define_table(your_own_parser('dog: name unique, owner person by
> > > name'))
> >
> > Of course, you do not need to type the calls literally --- you can do
> this
> > now;  actually, you can do BOTH of these last two now --- so I do not see
> > any point here...
> >
> > thus breaking what could be a new unified syntax into two levels where
> >
> > > some of it is specified by web2py and some is left to the user.
> >
> > I do not see substance backing this  - your argument for the last 2 of
> your
> > three examples applies equally any web2py release, so it is merely an
> > emotional argument (not a technical one).
> >
> > You are arguing for a new API for table definitions.   I started by
> > questioning the granularity of it.   The 2 ways to define fields NOW is
> > already not clear to web2py group ("Massimo - why do you use db.Field()
> and
> > not SQLField()?  What is the difference? When do I use which?" --- you
> will
> > now add a third option; let's not build a PERL!).
> >
> > > moreover what now was implemented by only defining only one private
> > > function called only by define table, would become something more
> > > pervasive, requiring to change define_table, the constructor of the
> > > SQLField objects and require one exposed function.
> >
> > I do not understand why you bring in changing the constructor of SQLField
> > objects or exposing functions --- I would merely cut by 1/3 or more what
> you
> > already have in autofields(), no more than you have (only less), and
> leave
> > the table-naming login in one place (take the duplication out of
> > autofields()).  No more.  Maybe not even that.
> >
> > You added a private call to define_table; my suggestion only simplifies
> it

[web2py:19827] Re: WSGI, Apache2, and web2py NOT at root

2009-04-15 Thread Mark Larsen

> See if http://forum.webfaction.com/viewtopic.php?pid=8473#p8473
> provides any hints for you

Thanks Yarko.

It still has the troublesome line:

WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/wsgihandler.py

Which essentially tells apache to handle anything coming at the root
of the server through the wsgihandler.py

I did figure out a hack if anyone comes up against this problem:

RewriteEngine on
RewriteRule ^/[NAMEOFAPP](.*)$ /web2py/[NAMEOFAPP]$1 [PT,L]
WSGIScriptAlias /web2py /opt/web2py/wsgihandler.py

This essentially allows you to place web2py outside of root.
Mod_Rewrite then rewrites the URLs to fix what would be broken URLs so
when URL() function writes:

http://server/nameofapp/

it becomes:

http://server/web2py/nameofapp

The PT (pass-through) directive ensures the users does not see the rewriten URL.

Thanks,

Mark

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19828] Re: Problem with pack (truncated tar files)

2009-04-15 Thread Yarko Tymciurak
this is interesting as I was going to ask when we would work on being
2.6 compatible (since I started looking at parsers,  and may have other
interests in potentially using 2.6+ only things).

On Tue, Apr 14, 2009 at 11:05 PM, mdipierro  wrote:

>
> There is a python 2.5 requirement mostly because that is what I
> tested.
>
> This looks like a bug in the tar module that ships with 2.6.1.
>
> Massimo
>
> On Apr 14, 10:04 pm, John  wrote:
> > It is reproducible (at least on my machine).
> >
> > Same problem with Firefox 3 and Safari 4beta.  The tar file placed in
> > web2py/deposit exhibits the same problem as the file that is
> > downloaded.  Both files are identical as verified by md5 checksums, so
> > it is not happing during the transfer, but with I am guessing the tar
> > function.
> >
> > Switching over to the windows side, after setting up my app
> > "manually", I am able to pack, and then verify the tar.  No problems.
> >
> > Time passes...and I get an idea while writing this response.
> >
> > Looking like the problem is on the mac side I decided to check a
> > couple things.  Turns out I am running Python 2.6.1 (from macports and
> > running web2py from source).  If I use the "default" python 2.5.1, my
> > tar problem goes away.
> >
> > It looks like a Python v2.6.1 vs v2.5.1 that causes this issue.  Is
> > there a Python 2.5 requirement for web2py, or is this a version
> > difference bug?
> >
> > John
> >
> > On Apr 14, 10:22 pm, mdipierro  wrote:
> >
> > > Is this reproducible? Does the browser make a difference?
> > > Can you try delete everything under web2py/deposit and try again?
> >
> > > Massimo
> >
> > > On Apr 14, 7:58 pm, John  wrote:
> >
> > > > I have been experiencing some issues with "pack all", and attempting
> > > > to deploy an app on a different web2py instance.
> >
> > > > Long version: (for others that might be experiencing the same thing)
> > > > My dev machine is a mac and the other test bed box is a windows vm
> > > > (not that it matters).  I was seeing some odd behavior on the windows
> > > > side after an import of my app, namely none of my jQuery stuff was
> > > > working.  Firebug was complaining about jQuery, so I verified that I
> > > > could infact get to the jquery.js through the browser.  My next
> > > > thought was that something was up with the web2py_ajax.html.  I was
> > > > right, though not like I was thinking.  Turns out the the file was
> > > > empty (zero bytes).
> >
> > > > I go back to the mac side, and test the tar file generate by pack.
> > > > Tar was not happy with the archive, in fact it stopped with
> > > > web2py_ajax.html
> >
> > > > galt:Downloads john$ tar -tvf web2py.app.wammo.tar
> > > > drwxr-xr-x john/staff0 2009-04-14 18:49:29 ./
> > > > 
> > > > lots of files/dirs
> >
> > > > -rw-r--r-- john/staff 2098 2009-04-14 18:23:18 views/layout.html
> > > > -rw-r--r-- john/staff 2243 2009-04-05 17:16:53 views/
> > > > web2py_ajax.html
> > > > tar: Unexpected EOF in archive
> > > > tar: Error is not recoverable: exiting now
> >
> > > > For what it is worth, it always seems to die with that same file.
> > > > Also, the 'pack compiled' does not seem to exhibit the same problem.
> > > > At least, it my few tests I seem to get a clean tar each time.
> >
> > > > I am running the web2py 1.61 (I also was seeing this in a previous
> > > > version 1.57 IIRC, but didn't take the time to investigate)
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19829] web2py 1.61.1 is out

2009-04-15 Thread mdipierro

Fixes a bug introduced in 1.61 that caused inability to run bytecode
compiled apps. Thanks to CJ for reporting this.

Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19830] Re: Conditioning IS_IN_DB

2009-04-15 Thread JohnMc

I have a similar situation to that of Mr. Jeppesen. Here is the setup
--

db.define_table('states',
SQLField('State','string',length=2)

)


db.define_table('provider',
...
...
SQLField('State',db.states),
...
...

)

db.provider.State.requires=IS_IN_DB(db,'states.id','%(State)s')

If one fills out a form the appropriate State dropdown appears. When a
database db select is performed the provider.State contains the number
3. That happens to be the proper states.id for the entry. My question
is how does one have say 'TX' rather than 3 as the entry in
provider.State?

Sorry for the newbieness of the query.

Thanks.

JohnMc





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19831] Re: Conditioning IS_IN_DB

2009-04-15 Thread mdipierro

db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s')

Massimo

On Apr 15, 2:59 pm, JohnMc  wrote:
> I have a similar situation to that of Mr. Jeppesen. Here is the setup
> --
>
> db.define_table('states',
>                 SQLField('State','string',length=2)
>
> )
>
> db.define_table('provider',
>                 ...
>                 ...
>                 SQLField('State',db.states),
>                 ...
>                 ...
>
> )
>
> db.provider.State.requires=IS_IN_DB(db,'states.id','%(State)s')
>
> If one fills out a form the appropriate State dropdown appears. When a
> database db select is performed the provider.State contains the number
> 3. That happens to be the proper states.id for the entry. My question
> is how does one have say 'TX' rather than 3 as the entry in
> provider.State?
>
> Sorry for the newbieness of the query.
>
> Thanks.
>
> JohnMc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19832] Re: Conditioning IS_IN_DB

2009-04-15 Thread JohnMc

Hmm. Unfortunately I receive --

  File "/home/rootuser/web2py/gluon/sqlhtml.py", line 544, in accepts
fields[fieldname] = int(fields[fieldname])
ValueError: invalid literal for int() with base 10: 'TX'

Thanks

On Apr 15, 3:06 pm, mdipierro  wrote:
> db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s')
>
> Massimo
>
> On Apr 15, 2:59 pm, JohnMc  wrote:
>
> > I have a similar situation to that of Mr. Jeppesen. Here is the setup
> > --
>
> > db.define_table('states',
> >                 SQLField('State','string',length=2)
>
> > )
>
> > db.define_table('provider',
> >                 ...
> >                 ...
> >                 SQLField('State',db.states),
> >                 ...
> >                 ...
>
> > )
>
> > db.provider.State.requires=IS_IN_DB(db,'states.id','%(State)s')
>
> > If one fills out a form the appropriate State dropdown appears. When a
> > database db select is performed the provider.State contains the number
> > 3. That happens to be the proper states.id for the entry. My question
> > is how does one have say 'TX' rather than 3 as the entry in
> > provider.State?
>
> > Sorry for the newbieness of the query.
>
> > Thanks.
>
> > JohnMc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19833] default as update instead of read

2009-04-15 Thread Wes James

Is there a line for update instead of read for:

/default/data/select/table

I'd like to have the select links be updates

.../default/data/update/table/id

instead of

.../default/data/read/table/id

thx,

-wj

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19834] redirect and response.flash

2009-04-15 Thread ceej

Is there a reason response.flash doesn't work with redirect('/') ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19835] Re: Conditioning IS_IN_DB

2009-04-15 Thread mdipierro

Let me look into this tonight. It may be a bug.

Massimo

On Apr 15, 3:29 pm, JohnMc  wrote:
> Hmm. Unfortunately I receive --
>
>   File "/home/rootuser/web2py/gluon/sqlhtml.py", line 544, in accepts
>     fields[fieldname] = int(fields[fieldname])
> ValueError: invalid literal for int() with base 10: 'TX'
>
> Thanks
>
> On Apr 15, 3:06 pm, mdipierro  wrote:
>
> > db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s')
>
> > Massimo
>
> > On Apr 15, 2:59 pm, JohnMc  wrote:
>
> > > I have a similar situation to that of Mr. Jeppesen. Here is the setup
> > > --
>
> > > db.define_table('states',
> > >                 SQLField('State','string',length=2)
>
> > > )
>
> > > db.define_table('provider',
> > >                 ...
> > >                 ...
> > >                 SQLField('State',db.states),
> > >                 ...
> > >                 ...
>
> > > )
>
> > > db.provider.State.requires=IS_IN_DB(db,'states.id','%(State)s')
>
> > > If one fills out a form the appropriate State dropdown appears. When a
> > > database db select is performed the provider.State contains the number
> > > 3. That happens to be the proper states.id for the entry. My question
> > > is how does one have say 'TX' rather than 3 as the entry in
> > > provider.State?
>
> > > Sorry for the newbieness of the query.
>
> > > Thanks.
>
> > > JohnMc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19836] Re: default as update instead of read

2009-04-15 Thread mdipierro

Currently there is no flag to change it. I will add one.

Massimo

On Apr 15, 5:40 pm, Wes James  wrote:
> Is there a line for update instead of read for:
>
> /default/data/select/table
>
> I'd like to have the select links be updates
>
> .../default/data/update/table/id
>
> instead of
>
> .../default/data/read/table/id
>
> thx,
>
> -wj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19837] Re: redirect and response.flash

2009-04-15 Thread mdipierro

Because I cannot find a way to make it work. I do not believe it is
possible. I may be wrong and if you find a way send me a patch.

Massimo

On Apr 15, 6:38 pm, ceej  wrote:
> Is there a reason response.flash doesn't work with redirect('/') ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19838] Re: Conditioning IS_IN_DB

2009-04-15 Thread mdipierro

This is not a bug. I misunderstood the question.

db.define_table('states',
SQLField('State','string',length=2)

)

db.define_table('provider',
...
...
SQLField('State'),  ### has to be a string to store a
string in it.
...
...
)
db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s')

On Apr 15, 7:03 pm, mdipierro  wrote:
> Let me look into this tonight. It may be a bug.
>
> Massimo
>
> On Apr 15, 3:29 pm, JohnMc  wrote:
>
> > Hmm. Unfortunately I receive --
>
> >   File "/home/rootuser/web2py/gluon/sqlhtml.py", line 544, in accepts
> >     fields[fieldname] = int(fields[fieldname])
> > ValueError: invalid literal for int() with base 10: 'TX'
>
> > Thanks
>
> > On Apr 15, 3:06 pm, mdipierro  wrote:
>
> > > db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s')
>
> > > Massimo
>
> > > On Apr 15, 2:59 pm, JohnMc  wrote:
>
> > > > I have a similar situation to that of Mr. Jeppesen. Here is the setup
> > > > --
>
> > > > db.define_table('states',
> > > >                 SQLField('State','string',length=2)
>
> > > > )
>
> > > > db.define_table('provider',
> > > >                 ...
> > > >                 ...
> > > >                 SQLField('State',db.states),
> > > >                 ...
> > > >                 ...
>
> > > > )
>
> > > > db.provider.State.requires=IS_IN_DB(db,'states.id','%(State)s')
>
> > > > If one fills out a form the appropriate State dropdown appears. When a
> > > > database db select is performed the provider.State contains the number
> > > > 3. That happens to be the proper states.id for the entry. My question
> > > > is how does one have say 'TX' rather than 3 as the entry in
> > > > provider.State?
>
> > > > Sorry for the newbieness of the query.
>
> > > > Thanks.
>
> > > > JohnMc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19839] Can response.flash have different colors?

2009-04-15 Thread Iceberg

Currently I think most of us use response.flash as a resort to give
all kinds of feedback. For example:

def foo():
  form=SQLFORM(...)
  if form.accepts(...):
if there_is_some_minor_issue:
  response.flash='Warning: your input is unusual, but anyway the
data is accepted'
else:
  response.flash='ok, data is accepted'
  if form.errors:
response.flash='Something is wrong'

Now all flash message show up in an orange bar. Can we have some
extended flash to be shown in different color? For example,
  response.flash_warn shows in yellow bar
  response.flash_info shows in light green bar
  response.flash_error shows in orange or even red bar

Perhaps session.flash should also support this proposal too?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19840] Re: Can response.flash have different colors?

2009-04-15 Thread Jason Brower

Sure.  I even have a totally different design for mine.
I made it fade in instead, and I had it use an entire block.  I did that
with the jquery calls in the web_ajax.html file in the view section.
Then I set the area in my layout.html.  Basically, take the old flash
area text and cut and past it where you want it.
>From there you start creating some css to go with it.
If you need more details I can share it with you.  I should probably at
it to the wiki at that point.
BR
Jason


On Wed, 2009-04-15 at 19:13 -0700, Iceberg wrote:
> Currently I think most of us use response.flash as a resort to give
> all kinds of feedback. For example:
> 
> def foo():
>   form=SQLFORM(...)
>   if form.accepts(...):
> if there_is_some_minor_issue:
>   response.flash='Warning: your input is unusual, but anyway the
> data is accepted'
> else:
>   response.flash='ok, data is accepted'
>   if form.errors:
> response.flash='Something is wrong'
> 
> Now all flash message show up in an orange bar. Can we have some
> extended flash to be shown in different color? For example,
>   response.flash_warn shows in yellow bar
>   response.flash_info shows in light green bar
>   response.flash_error shows in orange or even red bar
> 
> Perhaps session.flash should also support this proposal too?
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19841] The session dies and I have to reload a page to bring it back up and other issues...

2009-04-15 Thread Jason Brower

A minor issue I am sure, but when I am developing I leave all the
windows open just the way a like and suspend and comeback at a later
time.  Doing so makes my editor windows say the have a "communication
error" because my session timed out.  I would like it to be able to let
me log back in to my session without losing data that I have done.
Related is when I edit a document I don't think it should be a green
bar.  It should only be green when the data is saved.  After that we
don't know if it has been edited or not.
BR...
Jason


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19842] Giving a class to all buttons.

2009-04-15 Thread Jason Brower

I am trying to make jquery pull all the buttons made in my forms and
turn them into nice looking html buttons.
I have all the code ready except that I don't know how to set a class to
a button.  I didn't notice any class set to the buttons now either.
What would be the best approach to this?
Regards,
Jason Brower



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19843] Re: redirect and response.flash

2009-04-15 Thread Italo Maia

In django, they use a messaging system based in the database, and
relate messages from the user with his session. When the message is
fetched to the user, it is then removed immediatly. That makes it
possible for redirects to show messages for an user after a redirect,
tought it does not work for non-authenticated users. Maybe if you
could relate messages in the database to the user ip if he is not
logged, and to his session, if he is logged...that could do the
trick.

For what i understand, you can't flash messages to an user after a
redirect because the flash message get's stored in the response for
the original request. After a redirect, a new request is made, and a
new response is created, so, the application has no way to remember
that a flash message was generated.

Another way to store "flash" messages could be storing them in a
cookie before the redirect, and erase them after reading them.
Probably not a safe choice for some systems, and if cookies is turned
off in the browser, the messages would get lost.

There's one more way that i can think of. You could, in the redirect,
specify a GET parameter like: &message_status=1. That could do the
trick, nice and dirty, tough you would have to filter messages
depending on user previlegies or something.

On 15 abr, 21:07, mdipierro  wrote:
> Because I cannot find a way to make it work. I do not believe it is
> possible. I may be wrong and if you find a way send me a patch.
>
> Massimo
>
> On Apr 15, 6:38 pm, ceej  wrote:
>
> > Is there a reason response.flash doesn't work with redirect('/') ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19844] db.Field or SQLField??

2009-04-15 Thread Italo Maia

Just saw a video (http://www.vimeo.com/2720410) where db.Field was
user, and not SQLField...Which should be used?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19845] Re: Can response.flash have different colors?

2009-04-15 Thread mdipierro

response.flash is just a variable and so is session.flash.
session.flash is copied into response.flash after redirection.

You are free to do things like:

session.flash=['warning','red','message']

or

session.flash='warning/red/message'

and have the JS break use its components. I'd prefer to leave it as a
string to keep it working with the default layout.

On Apr 15, 9:56 pm, Jason Brower  wrote:
> Sure.  I even have a totally different design for mine.
> I made it fade in instead, and I had it use an entire block.  I did that
> with the jquery calls in the web_ajax.html file in the view section.
> Then I set the area in my layout.html.  Basically, take the old flash
> area text and cut and past it where you want it.>From there you start 
> creating some css to go with it.
>
> If you need more details I can share it with you.  I should probably at
> it to the wiki at that point.
> BR
> Jason
>
> On Wed, 2009-04-15 at 19:13 -0700, Iceberg wrote:
> > Currently I think most of us use response.flash as a resort to give
> > all kinds of feedback. For example:
>
> > def foo():
> >   form=SQLFORM(...)
> >   if form.accepts(...):
> >     if there_is_some_minor_issue:
> >       response.flash='Warning: your input is unusual, but anyway the
> > data is accepted'
> >     else:
> >       response.flash='ok, data is accepted'
> >   if form.errors:
> >     response.flash='Something is wrong'
>
> > Now all flash message show up in an orange bar. Can we have some
> > extended flash to be shown in different color? For example,
> >   response.flash_warn shows in yellow bar
> >   response.flash_info shows in light green bar
> >   response.flash_error shows in orange or even red bar
>
> > Perhaps session.flash should also support this proposal too?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19846] Re: The session dies and I have to reload a page to bring it back up and other issues...

2009-04-15 Thread mdipierro

The editor is not supposed to expire the session because there is a
keepalive ajax request.
If it is disconnecting you than there is a bug. Can you add a print
statement to the admin/controller/keepalive and check what is going
on?

Massimo

On Apr 15, 10:08 pm, Jason Brower  wrote:
> A minor issue I am sure, but when I am developing I leave all the
> windows open just the way a like and suspend and comeback at a later
> time.  Doing so makes my editor windows say the have a "communication
> error" because my session timed out.  I would like it to be able to let
> me log back in to my session without losing data that I have done.
> Related is when I edit a document I don't think it should be a green
> bar.  It should only be green when the data is saved.  After that we
> don't know if it has been edited or not.
> BR...
> Jason
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19848] Re: db.Field or SQLField??

2009-04-15 Thread mdipierro

db.Field() because it avoid conflicts when running on Google App
Engine.

On Apr 15, 10:37 pm, Italo Maia  wrote:
> Just saw a video (http://www.vimeo.com/2720410) where db.Field was
> user, and not SQLField...Which should be used?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19847] Re: redirect and response.flash

2009-04-15 Thread mdipierro

I think that storing messages in the database is overkill and storing
them in cookies is unsafe (unless we encrypt cookies and that is also
overkill) and would not work when cookies are off.

What is so bad about the current way of doing it?

Massimo

On Apr 15, 10:21 pm, Italo Maia  wrote:
> In django, they use a messaging system based in the database, and
> relate messages from the user with his session. When the message is
> fetched to the user, it is then removed immediatly. That makes it
> possible for redirects to show messages for an user after a redirect,
> tought it does not work for non-authenticated users. Maybe if you
> could relate messages in the database to the user ip if he is not
> logged, and to his session, if he is logged...that could do the
> trick.
>
> For what i understand, you can't flash messages to an user after a
> redirect because the flash message get's stored in the response for
> the original request. After a redirect, a new request is made, and a
> new response is created, so, the application has no way to remember
> that a flash message was generated.
>
> Another way to store "flash" messages could be storing them in a
> cookie before the redirect, and erase them after reading them.
> Probably not a safe choice for some systems, and if cookies is turned
> off in the browser, the messages would get lost.
>
> There's one more way that i can think of. You could, in the redirect,
> specify a GET parameter like: &message_status=1. That could do the
> trick, nice and dirty, tough you would have to filter messages
> depending on user previlegies or something.
>
> On 15 abr, 21:07, mdipierro  wrote:
>
> > Because I cannot find a way to make it work. I do not believe it is
> > possible. I may be wrong and if you find a way send me a patch.
>
> > Massimo
>
> > On Apr 15, 6:38 pm, ceej  wrote:
>
> > > Is there a reason response.flash doesn't work with redirect('/') ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19849] Re: The session dies and I have to reload a page to bring it back up and other issues...

2009-04-15 Thread Jason Brower

Sorry, I haven't a clue how to do that. :(  But would be happy to learn.
BR
Jason Brower


On Wed, 2009-04-15 at 21:50 -0700, mdipierro wrote:
> The editor is not supposed to expire the session because there is a
> keepalive ajax request.
> If it is disconnecting you than there is a bug. Can you add a print
> statement to the admin/controller/keepalive and check what is going
> on?
> 
> Massimo
> 
> On Apr 15, 10:08 pm, Jason Brower  wrote:
> > A minor issue I am sure, but when I am developing I leave all the
> > windows open just the way a like and suspend and comeback at a later
> > time.  Doing so makes my editor windows say the have a "communication
> > error" because my session timed out.  I would like it to be able to let
> > me log back in to my session without losing data that I have done.
> > Related is when I edit a document I don't think it should be a green
> > bar.  It should only be green when the data is saved.  After that we
> > don't know if it has been edited or not.
> > BR...
> > Jason
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19850] Re: web2py_path setting in gluon/main.py causing problems for scripts

2009-04-15 Thread Guido Kollerie


On 8-apr-2009, at 18:33, mdipierro wrote:

> OK, uploading to trunk. Thanks.

I see you have reverted the change:

 
http://code.google.com/p/web2py/source/diff?spec=svn822&r=822&format=side&path=/trunk/gluon/main.py&old_path=/trunk/gluon/main.py&old=817

due to "__file__ caused problems on osx"

Thing is I am running on OS X and not experiencing any problems. Out  
of curiosity what scenario caused problems?

Cheers, Guido

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19851] How do I add a class to an input button?

2009-04-15 Thread Jason Brower

I can't grab a button, like submit buttons, with jquery.  At least as
far as I can tell.  I have to add a class to them.  So...
How do I add a class to buttons in my SQLForms?
BR
Jason Brower




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19852] Re: redirect and response.flash

2009-04-15 Thread Italo Maia

After changes in the database, like submiting a form, if you're not
"ajaxing things up!", is good practice to redirect the user to some
page. This avoids the problem where the refresh button from the
browser would re-submit the form and stuff like that. If you can't
send flash messages after a redirect, you can't use the good practice
behavior "by default". For the users i know, that redirect is pretty
much a life savior, and they never know what happened without a nice
message after the submit.

On 16 abr, 01:53, mdipierro  wrote:
> I think that storing messages in the database is overkill and storing
> them in cookies is unsafe (unless we encrypt cookies and that is also
> overkill) and would not work when cookies are off.
>
> What is so bad about the current way of doing it?
>
> Massimo
>
> On Apr 15, 10:21 pm, Italo Maia  wrote:
>
> > In django, they use a messaging system based in the database, and
> > relate messages from the user with his session. When the message is
> > fetched to the user, it is then removed immediatly. That makes it
> > possible for redirects to show messages for an user after a redirect,
> > tought it does not work for non-authenticated users. Maybe if you
> > could relate messages in the database to the user ip if he is not
> > logged, and to his session, if he is logged...that could do the
> > trick.
>
> > For what i understand, you can't flash messages to an user after a
> > redirect because the flash message get's stored in the response for
> > the original request. After a redirect, a new request is made, and a
> > new response is created, so, the application has no way to remember
> > that a flash message was generated.
>
> > Another way to store "flash" messages could be storing them in a
> > cookie before the redirect, and erase them after reading them.
> > Probably not a safe choice for some systems, and if cookies is turned
> > off in the browser, the messages would get lost.
>
> > There's one more way that i can think of. You could, in the redirect,
> > specify a GET parameter like: &message_status=1. That could do the
> > trick, nice and dirty, tough you would have to filter messages
> > depending on user previlegies or something.
>
> > On 15 abr, 21:07, mdipierro  wrote:
>
> > > Because I cannot find a way to make it work. I do not believe it is
> > > possible. I may be wrong and if you find a way send me a patch.
>
> > > Massimo
>
> > > On Apr 15, 6:38 pm, ceej  wrote:
>
> > > > Is there a reason response.flash doesn't work with redirect('/') ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:19853] Mutable urls

2009-04-15 Thread Italo Maia

I was trying to make one of those fancy url behaviors where the name
of the url actually has some meaning. Well, i was trying to create a
blog and wanted to have this kind of url to be valid:

http://site.com/blog/blog-name/year/month/day/id/

would be valid and the parameters blog-name, year, month, day and id
would be avaiable in the controller. How could i do that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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
-~--~~~~--~~--~--~---