[web2py:19352] Form validators are being executed upon deleting a record
Hi, Accidentally came across the following scenario which I suspect to have exposed a bug in Web2py. While working on an application I noticed I had identical values occurring in a particular column. E.g. given: db = SQLDB('sqlite://storage.db') db.define_table('person',SQLField('name')) I found I had something like below in my database: person.id person.name 1 Guido 2 Jort 3 Guido I realised 'person.name' should have been unique. Hence I added to following to my model definition: db.person.name.requires=IS_NOT_IN_DB(db, 'person.name') Then I set out to remove the non unique entries ('Guido' in this case) by hand using appadmin. Clicking on 'db.person' in de admin showed the table above. Next I clicked on 'person.id' 3, checked the 'Check to delete' checkbox and clicked 'submit'. The newly added validator was executed as I got the following error: 'value already in database!' I would have expected this validator to be *only* executed on inserts and updates, though not on deletes. Is this a bug in Web2py? -- 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:19353] Re: response.flash problem
Denes, Thanks for pointing me in the right direction, the {{pass}} was missing here: {{pass}} After fixing this problem I found out something else. I made a static layout; plain xhtml and a css. When I use this layout in web 2py the header and footer display alright, however the and everything within in fall apart, i.e. aren't styled properly. e.g. the contents is displayed but the enclosing doesn't have a hight. Do you have any idea what causes this problem. 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:19354] Re: not unicode
I don't know, in the function I want to use the following code if form.accepts(request.vars,session): code=db(db.postcoderegio.regio==request.vars.regio).select (db.postcoderegio.min,db.postcoderegio.max) clubs=db().select(db.company.ALL,db.address.ALL,left=db.address.on ( (db.address.company==db.company.id)&(db.address.zipcodecode.min))) I thought, since I want to use the < and > operator regio, min and max need to be of type integer. Hence the IS_INT_IN_RANGE() validator. Do I achieve the same validation when I use the IS_MATCH() validator? 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:19355] Re: Is there a way to store session in memory?
A note, often the OS's disk caching (esp with linux style cache) is enough speedwise, it is worth going for memory only if you're 100% sure that the disk is a bottleneck. Otherwise, by dedicating memory to cache or tmpfs you can actually slow yourself down in a low mem situation (by forcing apache or python to swap). On Apr 7, 12:24 am, Kuba Kucharski wrote: > I thought about ramdisk, but tmpfs might be a better solution, > practically it is the same. Main difference between tmpfs and linux > ramdisk device is that tmpfs alocate memory dynamically and also > less-used "pages" can be moved onto swap space. > > On modern linux distros it is as easy as: > > mount -t tmpfs tmpfs $folder_path -o rw,size=$size > > where: > $folder_path is a path to the folder you wish to make "turbocharged" > > $size is the amount of memory you want to dedicate( M - megabytes ) > > for example: > > mount -t tmpfs tmpfs /usr/local/web2py/applications/example/cache -o > rw,size=200M > mount -t tmpfs tmpfs /usr/local/web2py/applications/example/sessions > -o rw,size=200M > > you can of course do something like that: > > mkdir /usr/local/web2py/applications/example/databases/ramdisk/ > mount -t tmpfs tmpfs > /usr/local/web2py/applications/example/databases/ramdisk/ -o > rw,size=20M > > and then > > SQLDB('sqlite:///usr/local/web2py/applications/example/databases/ramdisk/ramstorage.db') > > -- > Kuba --~--~-~--~~~---~--~~ 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:19357] Re: Is there a way to store session in memory?
Yes, thank you, Achipa. I forgot to warn about it, I will add this to an AlterEgo entry as soon as I can edit it. -- Kuba --~--~-~--~~~---~--~~ 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:19358] Re: Coooooool!
Very nice and cool! Because of the static height (style="height: 35px;" in views/default/ index.html) it only works for me when moving the div/window away from the left column. is jDiv and the new web2py_ajax.html finding its to web2py or a svn repository? Niels On 6 Apr., 08:09, mdipierro wrote: > I just changed the layout > > http://www.web2py.com/events/default/indexhttp://www.web2py.com/examples/static/web2py.app.events.tar > > try: > - click on "form" > - type a= 2 [enter] > - type b= 3 [enter] > > - click on "post a message" > - type something and see the "list messages" open up automatically > > - click on "register" and "login" and "logout" > > - click on watch the movie! > > - move jDivs (the windows) around. > > - look at the source code on default.py > > Isn't this cool? > Pros? Cons? Suggestions for improvement? > > 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:19359] how to do autoindex for directories & serve static html files
Hello, can I use web2py to to something like autoindex for directories? In Apache it is called mod_autoindex (http://httpd.apache.org/docs/2.0/ mod/mod_autoindex.html). What is the best way to serve static pages like a Sphinx documentation built? Shall I just put the files into the "view" folder of my application? Thanks and kind regards, Timmie --~--~-~--~~~---~--~~ 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:19361] Oracle: limitby
If you try to limitby complex query in oracle you get an error (duplicate records). Gluon currently works well for queries like db().select(db.details.ca_date, orderby=~db.details.ca_date, limitby= (0,1)) but does not work for joint tables e.g.: db(db.headers.id==db.details.header) \ .select(limitby=limitby, orderby=orderby, *fields) Error happens because DAL adds tables list at end of outer query, and no join condition for these tables. Therefore rows become duplicated by *limitby* limit value. Here is a patch for gluon/sql.py that solved the problem for me. It just adds WHERE clause used in the inner query, to the outer query. Don't know if it is efficient but at least works. starting with line 1856: if attributes.get('limitby', False): # oracle does not support limitby (lmin, lmax) = attributes['limitby'] if self._db._dbname == 'oracle': if not attributes.get('orderby', None): sql_o += ' ORDER BY %s' % ', '.join([t + '.id' for t in tablenames]) if len(sql_w) > 1: sql_w_row = sql_w + ' AND w_row >' else: sql_w_row = 'WHERE w_row >' return '%s %s FROM (SELECT w_tmp.*, ROWNUM w_row FROM (SELECT %s FROM %s%s%s) w_tmp WHERE ROWNUM<=%i) %s %s %i;' \ % (sql_s, sql_f, sql_f, sql_t, sql_w, sql_o, lmax, sql_t, sql_w_row, lmin) --~--~-~--~~~---~--~~ 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:19362] Oracle: date field type
Oracle handles DATE type similarly to DATETIME so it outputs date with timestamp 00:00:00. If you print out SQLRow you will see that it contains datetime.datetime(2009, 4, 6, 0, 0) But for portablility it should be datetime.date(2009, 4, 6, 0, 0) I could not identify correct place to patch in gluon/sql.py myself. model: db.define_table('details', SQLField('header', db.headers), SQLField('ca_date', 'date'), ... ) Resulting SQL SELECT and its output: SELECT details.ca_date FROM (SELECT w_tmp.*, ROWNUM w_row FROM (SELECT details.c a_date FROM details ORDER BY details.ca_date DESC) w_tmp WHERE ROWNUM<=1) detail s WHERE w_row > 0; details.ca_date 2009-04-06 00:00:00 --~--~-~--~~~---~--~~ 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:19356] Re: sample of application routes.py
Apropos, there was a patch to support per domain routes a week ago (or two), can you tell what's the status on that one ? On Apr 6, 9:40 pm, mdipierro wrote: > OK. email me the patch. > > Massimo > > On Apr 6, 2:09 pm, Robin B wrote: > > > I thought it would be cool to have a routes.py for each application, > > so I put the following in web2py/routes.py, which combines the routes > > from each application/*/routes.py at boot time. > > > web2py/routes.py: > > > from gluon.fileutils import listdir > > import os,glob > > apps_with_routes = [] > > app_routes = glob.glob('applications/*/routes.py') > > for ar in app_routes: > > dir,r = os.path.split(ar) > > dir,app = os.path.split(dir) > > apps_with_routes.append(app) > > > routes_in_list = routes_out_list = [] > > for app in apps_with_routes: > > module_name = 'applications.%s.routes' % app > > m = __import__(module_name,globals(),locals(),['']) > > routes_in_list.extend(list(m.routes_in)) > > routes_out_list.extend(list(m.routes_out)) > > > routes_in=set(routes_in_list) > > routes_out=set(routes_out_list) > > > applications/welcome/routes.py: > > > app = 'welcome' > > con = 'default' > > main = (app,con) > > > routes_in=( > > ('/','/%s/%s/index' % main), # homepage > > ) > > routes_out = [(x,y) for (y,x) in routes_in] > > > Using an approach like this allows you to distribute a routes.py with > > your application code. > > > Robin --~--~-~--~~~---~--~~ 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:19360] Oracle: GROUP BY
This code works in MySQL, SQLite: db(cond).select(db.carts.ALL, db.c_h.cart_id.count(), left=db.c_h.on(many_to_many), groupby=db.carts.id, orderby=carts_orderby, limitby = session.carts_limitby) Gives ORA-00979 error in Oracle: ORA-00979 not a GROUP BY expression Cause: The GROUP BY clause does not contain all the expressions in the SELECT clause. SELECT expressions that are not included in a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, must be listed in the GROUP BY clause. Action: Include in the GROUP BY clause all SELECT expressions that are not group function arguments. Workaround in DAL (tested in MySQL and Oracle): db(cond).select(db.carts.ALL, db.c_h.cart_id.count(), left=db.c_h.on(many_to_many), groupby=db.carts.ALL, orderby=carts_orderby, limitby = session.carts_limitby) But maybe it's better to put into gluon/sql.py for better portability? --~--~-~--~~~---~--~~ 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:19363] Re: Form validators are being executed upon deleting a record
Good catch but this this is fixed in trunk already. ;-) Will repost 1.60 soon. Massimo On Apr 7, 2:09 am, Guido Kollerie wrote: > Hi, > > Accidentally came across the following scenario which I suspect to have > exposed a bug in Web2py. > > While working on an application I noticed I had identical values > occurring in a particular column. E.g. given: > > db = SQLDB('sqlite://storage.db') > db.define_table('person',SQLField('name')) > > I found I had something like below in my database: > > person.id person.name > 1 Guido > 2 Jort > 3 Guido > > I realised 'person.name' should have been unique. Hence I added to > following to my model definition: > > db.person.name.requires=IS_NOT_IN_DB(db, 'person.name') > > Then I set out to remove the non unique entries ('Guido' in this case) > by hand using appadmin. Clicking on 'db.person' in de admin showed the > table above. Next I clicked on 'person.id' 3, checked the 'Check to > delete' checkbox and clicked 'submit'. > > The newly added validator was executed as I got the following error: > > 'value already in database!' > > I would have expected this validator to be *only* executed on inserts > and updates, though not on deletes. Is this a bug in Web2py? > > -- > 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:19364] Re: not unicode
\d{4} means 4 digits On Apr 7, 3:03 am, jmverm...@xs4all.nl wrote: > I don't know, in the function I want to use the following code > > if form.accepts(request.vars,session): > code=db(db.postcoderegio.regio==request.vars.regio).select > (db.postcoderegio.min,db.postcoderegio.max) > clubs=db().select(db.company.ALL,db.address.ALL,left=db.address.on > ( > (db.address.company==db.company.id)&(db.address.zipcode & > (db.address.zipcode>code.min))) > > I thought, since I want to use the < and > operator regio, min and max > need to be of type integer. Hence the IS_INT_IN_RANGE() validator. > > Do I achieve the same validation when I use the IS_MATCH() validator? > > 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:19365] Re: sample of application routes.py
I guess I lost it. On Apr 7, 4:12 am, AchipA wrote: > Apropos, there was a patch to support per domain routes a week ago (or > two), can you tell what's the status on that one ? > > On Apr 6, 9:40 pm, mdipierro wrote: > > > OK. email me the patch. > > > Massimo > > > On Apr 6, 2:09 pm, Robin B wrote: > > > > I thought it would be cool to have a routes.py for each application, > > > so I put the following in web2py/routes.py, which combines the routes > > > from each application/*/routes.py at boot time. > > > > web2py/routes.py: > > > > from gluon.fileutils import listdir > > > import os,glob > > > apps_with_routes = [] > > > app_routes = glob.glob('applications/*/routes.py') > > > for ar in app_routes: > > > dir,r = os.path.split(ar) > > > dir,app = os.path.split(dir) > > > apps_with_routes.append(app) > > > > routes_in_list = routes_out_list = [] > > > for app in apps_with_routes: > > > module_name = 'applications.%s.routes' % app > > > m = __import__(module_name,globals(),locals(),['']) > > > routes_in_list.extend(list(m.routes_in)) > > > routes_out_list.extend(list(m.routes_out)) > > > > routes_in=set(routes_in_list) > > > routes_out=set(routes_out_list) > > > > applications/welcome/routes.py: > > > > app = 'welcome' > > > con = 'default' > > > main = (app,con) > > > > routes_in=( > > > ('/','/%s/%s/index' % main), # homepage > > > ) > > > routes_out = [(x,y) for (y,x) in routes_in] > > > > Using an approach like this allows you to distribute a routes.py with > > > your application code. > > > > Robin --~--~-~--~~~---~--~~ 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:19366] Raw filesystem instead DB
Hello, Massimo and all! Could you explain whether would web2py work with dispersed datafiles in some folder structure? Such kind of data storage provides separated data objects in XML or JSON format with not-limited security (any of NTFS features). Also the easy merge of local and remote (web) data objects is possible. I guess it can be done with special code in controllers only. But could be any profit from web2py's Database Abstraction Layer in such environment? For example, some db = FILEDB(‘xmlrepos://user:passw...@hostname/dataroot') db.define_table('person', 'URL/person.xsd') - indeed create subfolder for file-records with the given schema. and so on, only instead of sql table there is a file directory with file-records, all with the same structure. The principal wish is to use autogenerated forms with validators from such model. Is it possible to construct in controller a custom substitute of form=SQLFORM(db.table) for using {{=form}} in the view after that? Vale! --~--~-~--~~~---~--~~ 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:19367] Re: response.flash problem
On Apr 7, 3:36 am, jmverm...@xs4all.nl wrote: > After fixing this problem I found out something else. I made a static > layout; plain xhtml and a css. When I use this layout in web 2py the > header and footer display alright, however the > and everything within in fall apart, i.e. aren't styled properly. > e.g. the contents is displayed but the enclosing div> doesn't have a hight. > > Do you have any idea what causes this problem. It is hard to tell without having all the pieces involved. I suggest using Firefox with Firebug, it shows you the exact styling being used on any element (among a myriad of other valuable info). > > 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:19368] make validator ignore empty string
Hi, i need to make a validation like 'nothing or email', but IS_EMAIL is always complaining even on empty string. How to combine required validators to do this EMPTY or EMAIL ? Michal alias Plysak --~--~-~--~~~---~--~~ 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:19369] Re: make validator ignore empty string
IS_NULL_OR(IS_EMAIL()) On Apr 7, 8:47 am, Michal Jursa wrote: > Hi, > i need to make a validation like 'nothing or email', but IS_EMAIL is > always complaining even on empty string. How to combine required > validators to do this EMPTY or EMAIL ? > > Michal alias Plysak --~--~-~--~~~---~--~~ 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:19370] Oracle: long text inserting
I hope my today's activity with Oracle testing helps to improve web2py! Model: db.define_table('settings', SQLField('created_at', 'datetime', default=datetime.datetime.now ()), SQLField('meta', 'text'), ) Controller action: outp = 'Long text longer than 4000 symbols' db.settings.insert(meta=outp) gives error ORA-01704: string literal too long I found a workaround but it should be in gluon eventualy: if db._dbname == 'oracle': cursor = db._connection.cursor() #cursor.setinputsizes(value = cx_Oracle.CLOB) cursor.execute("insert into settings(meta) values (:value)", value = outp) else: db.settings.insert(meta=outp) --~--~-~--~~~---~--~~ 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:19371] Re: using web2py for Geo / GIS stuff
Thank you Massimo, I will inform you everything by email once I finish the preparation of my side. best regards: dbb On Apr 6, 10:01 pm, mdipierro wrote: > I am more than OK with this. I am happy you are doing it. What is your > timeline? > > Massimo > > On Apr 6, 8:32 pm, dbb wrote: > > > > > Thank you Massimo, my immediate need is to make kpax introduced to > > disadvantaged schools, make it known and used since I like the tool > > and it is helpful to teachers . > > I have a number of usage for kpax in this regard, what I need from you > > is to make the media ( movie player) and chat to work properly. The > > chat part is not pressing issue,but the media player is. The media > > player can also be used to train the teachers themslves. The Group > > ( working OK), the survey ( working OK), the folder( partially > > working, the movie part is not working), when an attachment is > > downloaded, fills the whole page and is not created on a separate > > page.The chat has error in java code, do not know what that is,it is > > not pressing issue for now.The news part works properly. > > > My other question is are you ok with it, if I introduce kpax to > > schools. The reason I am doing it is to gave back to the society that > > gave me the opportunity to be what I am know. > > > On Apr 6, 7:27 pm, mdipierro wrote: > > > > It is very interesting and I am heppy you choose web2py. If you have > > > any question I will be here. ;-) > > > > Massimo > > > > On Apr 6, 6:16 pm, dbb wrote: > > > > > I am your student now, I learnt a lot from you about web2py, actually > > > > I am a researcher at one of the labs in east cost, and a part time > > > > teacher -- I love computing science. > > > > I my vision for the mapping is to create (draw) a polygon that > > > > signifies a room in a building using a mouse, when somebody with a > > > > sensor is in the room, it will show the location of the person. The > > > > senor location can be determined using triagulation. This will attract > > > > the emerging sensor technology techies to web2py. There are so many > > > > applications for this particular idea. web2py is a good candidate > > > > since it has all the necessary components : MVC. Imagine you are in a > > > > museum, with a hand held instrument with a sensor attached to it, you > > > > are infront of Michaelanglo's piece of work, you press the curator > > > > button on the handheld instrument, bingo it starts talking about the > > > > piece for you alone. What do you think about this idea? > > > > > Best Regards: > > > > dbb > > > > > On Apr 3, 3:35 pm, Yarko Tymciurak wrote: > > > > > > You can use google maps - > > > > > An example output: > > > > > >https://us.pycon.org/2009/register/default/maps > > > > > > The code to accomplish (collect coordinates): > > > > > > def maps(): > > > > > inhttp://bazaar.launchpad.net/~yarkot1/web2conf/pycon2009site/annotate/... > > > > > > and: > > > > > >http://bazaar.launchpad.net/~yarkot1/web2conf/pycon2009site/annotate/... > > > > > > You can loose a few hours > > > > > here:http://code.google.com/apis/maps/documentation/ > > > > > > Have fun! > > > > > > On Fri, Apr 3, 2009 at 1:35 PM, dbb wrote: > > > > > > > We know we can get the longtitude and latitude of an address using > > > > > > web2py, what we need here is to make these points map to x,y > > > > > > coordinate and map the points on google map. Can Prof.Massimo > > > > > > directus > > > > > > how to convert lo,la to x,y, and map the points ( x,y) on google map > > > > > > in web2py world. > > > > > > > Best regards: > > > > > > > dbb > > > > > > > On Apr 3, 10:42 am, mdipierro wrote: > > > > > > > You want to look into this and talk to authors: > > > > > > >http://trac.sahanapy.org/browser/models/_gis.pyhttp://trac.sahanapy.o... > > > > > > > > Massimo > > > > > > > > On Apr 3, 6:06 am, Timmie wrote: > > > > > > > > > Dear web2py users/developers, > > > > > > > > I am mostly using python for scientific data processing. > > > > > > > > I would like to take my scripts to an internet/intranet site > > > > > > > > for a > > > > > > > > larger audience to benefit. Therefore I am evaluating python web > > > > > > > > frameworks. > > > > > > > > So far, the web2py approach is apealing most to me. Clean and > > > > > > > > easy to > > > > > > > > lean and administer. > > > > > > > > > But for a choice it is also important what existing extensions > > > > > > > > exist. > > > > > > > > > Here my questions: > > > > > > > > * Is there someone working on a site with Geographical data > > > > > > > > orGIS > > > > > > > > capabilities (e. g.:http://geo.turbogears.org/samplemap)? > > > > > > > > => I found the following threads: > > > > > > > > - Validators: IS_LAT & IS_LON [1] > > > > > > > > - Using stored procedures [2] > > > > > > > > => I didn't see any appliance (http://mdp.cti.depaul.edu/ > > > > > > > > appliances) of > > > > > > > > such nature. > > > > > > > > * How har
[web2py:19372] Newbie trying to get the auth role
Hi, I can get the first_name of a user loged in using first_name=auth.user.first_name. I assigned roles to the user. How can I get the role using something like role=auth.role? Thanks --~--~-~--~~~---~--~~ 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:19373] Re: make validator ignore empty string
ahh, thanks massimo i somehow missed this... Michal alias Plysak mdipierro wrote: > IS_NULL_OR(IS_EMAIL()) > > On Apr 7, 8:47 am, Michal Jursa wrote: >> Hi, >> i need to make a validation like 'nothing or email', but IS_EMAIL is >> always complaining even on empty string. How to combine required >> validators to do this EMPTY or EMAIL ? >> >> Michal alias Plysak > > --~--~-~--~~~---~--~~ 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:19375] Re: not unicode
On Apr 6, 11:01 am, annet wrote: > I have got the following model: > > db.define_table('postcoderegio', > SQLField('regio', type='integer', length=2, default='', > notnull=True), length is not valid with integer fields > SQLField('min', type='integer', length=4, default='', > notnull=True), > SQLField('max', type='integer', length=4, default='', > notnull=True), > SQLField('provincie', db.provincie, default='', notnull=True, > ondelete='RESTRICT'), > migrate=False) > > db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(00,99),IS_LENGTH(2), > IS_NOT_EMPTY()] same here, IS_LENGTH is invalid with integers (numbers don't have a length property in Python). > db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(,), IS_LENGTH > (4), IS_NOT_EMPTY()] you probably mean db.postcoderegio.min ... > db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(,), IS_LENGTH > (4), IS_NOT_EMPTY()] ... and db.postcoderegio.max (an example of copy/paste/forget-to-fix, it happens to me too) > db.postcoderegio.provincie.requires=IS_IN_DB(db, db.provincie.id, '% > (provincie)s') > > When I try to insert a record using the appadmin interface I get an > error on the regio field. The error message reads: not unicode. > > How do I solve this problem? And what is it's cause? > > Kind regards, > > Annet. I don't know how postal codes look like over there but Massimo's suggestion only works if they are exactly 4 digits long and if they are strings, otherwise you will get the same "Not Unicode" error. --~--~-~--~~~---~--~~ 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:19377] Re: Apache config.
a2enmod web2py returns "ERROR: Module web2py does not exist!" So am I missing a module?!? I've not read anything that indicates that a web2py module should exist. Maybe my eyes are not working?!? mime.conf and mime.load are indeed under /etc/apache/mods-enabled/ mime.conf contains the line: TypesConfig /etc/mime.types and furthermore mime.types contains the line: image/svg+xml svg svgz Could you do me a favor and post or email me your test apache vhost config? I'd like to compare differences. On Apr 6, 10:19 pm, bsnipes wrote: > Well.. got Ubuntu server installed and followed all the steps from the > manual excluding adding ssl to the vhost and up to ( but not > including ) the proxy part. 2 things seem to be missing from the > example that I see: > > 1. a2enmod web2py > 2. if I don't run 'python web2py.py' at least once the applications > folder isn't created > > When I go to example.com I am getting static files. I can place an svg > file in the applications directory and see the actual image in my > browser without doing any other changes. Currently I am not sure how > to get the apps to work but since that isn't what you need I'll work > on that at a different time. I have the following 2 modules enabled > and want to check if they are enabled in your apache instance: > > mods-enabled/mime.load > mods-enabled/mime.conf > > Brian --~--~-~--~~~---~--~~ 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:19376] Re: Newbie trying to get the auth role
On Apr 7, 9:10 am, Monty808 wrote: > I assigned roles to the user. How can I get the role using something > like role=auth.role? I don't know if this is the 'proper' way to do it but you could try: https://mdp.cti.depaul.edu/wiki/default/page/4ebc7198-eac5-4227-894f-b267879eb64b Brian --~--~-~--~~~---~--~~ 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:19378] Re: make validator ignore empty string
@Michal, tsk... tsk... bad etiquette... hijacking other people's posts. You can always open a new post with your issue. On Apr 7, 9:47 am, Michal Jursa wrote: > Hi, > i need to make a validation like 'nothing or email', but IS_EMAIL is > always complaining even on empty string. How to combine required > validators to do this EMPTY or EMAIL ? > > Michal alias Plysak --~--~-~--~~~---~--~~ 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:19379] Re: Apache config.
On Apr 7, 9:20 am, zxynax wrote: > a2enmod web2py returns "ERROR: Module web2py does not exist!" > oops... I guess that should be a2ensite web2py... I'll power on my laptop that I was testing with and paste them shortly. Brian --~--~-~--~~~---~--~~ 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:19380] Re: make validator ignore empty string
What? What have i done wrong? Michal DenesL wrote: > @Michal, > tsk... tsk... bad etiquette... hijacking other people's posts. > You can always open a new post with your issue. > > > On Apr 7, 9:47 am, Michal Jursa wrote: >> Hi, >> i need to make a validation like 'nothing or email', but IS_EMAIL is >> always complaining even on empty string. How to combine required >> validators to do this EMPTY or EMAIL ? >> >> Michal alias Plysak > > --~--~-~--~~~---~--~~ 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:19381] Re: make validator ignore empty string
Discussion subject changed to "make validator ignore empty string" by Michal Jursa You probably sent your message as a reply to an existing, instead of a typing a 'new' message. When you reply, the thread-id remains, so it will look funny (=harder to track) for people using threaded mail readers or those who follow the group through the web interface. On Apr 7, 4:29 pm, Michal Jursa wrote: > What? What have i done wrong? > > Michal > > DenesL wrote: > > @Michal, > > tsk... tsk... bad etiquette... hijacking other people's posts. > > You can always open a new post with your issue. > > > On Apr 7, 9:47 am, Michal Jursa wrote: > >> Hi, > >> i need to make a validation like 'nothing or email', but IS_EMAIL is > >> always complaining even on empty string. How to combine required > >> validators to do this EMPTY or EMAIL ? > > >> Michal alias Plysak --~--~-~--~~~---~--~~ 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:19382] Re: make validator ignore empty string
Whops, sorry, didn't know that, won't do it any more. Michal AchipA wrote: > > Discussion subject changed to "make validator ignore empty string" by > Michal Jursa > > You probably sent your message as a reply to an existing, instead of a > typing a 'new' message. When you reply, the thread-id remains, so it > will look funny (=harder to track) for people using threaded mail > readers or those who follow the group through the web interface. > > On Apr 7, 4:29 pm, Michal Jursa wrote: >> What? What have i done wrong? >> >> Michal >> >> DenesL wrote: >>> @Michal, >>> tsk... tsk... bad etiquette... hijacking other people's posts. >>> You can always open a new post with your issue. >>> On Apr 7, 9:47 am, Michal Jursa wrote: Hi, i need to make a validation like 'nothing or email', but IS_EMAIL is always complaining even on empty string. How to combine required validators to do this EMPTY or EMAIL ? Michal alias Plysak > > --~--~-~--~~~---~--~~ 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:19383] Re: Apache config.
I thought that's what you intended. But as I'm the one who's obviously not understanding something very simple - like the example in the deployment recipe section - I'm the one waving the idiot banner and as such have had all powers of assumption revoked. Anyway, I have enabled the site that utilizes the WGSI Directives. I'm able to navigate to the IP associated with the server and view the welcome page in all it's orange and bold text glory. One of the main differences to my config as to the examples is that Alias Directive line: "Alias / /home/web2py/applications/" In my config I have that commented out. As when I have it uncommented it doesn't allow WSGI to run. On Apr 7, 9:25 am, bsnipes wrote: > On Apr 7, 9:20 am, zxynax wrote: > > > a2enmod web2py returns "ERROR: Module web2py does not exist!" > > oops... I guess that should be a2ensite web2py... > > I'll power on my laptop that I was testing with and paste them > shortly. > > Brian --~--~-~--~~~---~--~~ 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:19384] Re: Is there a way to store session in memory?
Massimo, thanks for the hint about placing sqlite database in different folder. However I found it not fully work as expect, because those "abcdef123456_blah.table" are still created inside app/databases folder. Could you adjust the code so that all relevant *.table files are in the same folder as the "sqlite:///absolute/path"? By the way, hope you also figure out how to store session in memory. :-) On Apr7, 5:11am, mdipierro wrote: > Yes > > SQLDB('sqlite:///absolue/path') > > notice the /// > > On Apr 6, 4:07 pm, Kuba Kucharski wrote: > > > "Is there a way" in web2py to place sqlite database somewhere else > > than "databases" folder ? --~--~-~--~~~---~--~~ 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:19385] response.flash problem
Thank you. On Apr 7, 10:43 am, Michal Jursa wrote: > Whops, sorry, didn't know that, won't do it any more. > > Michal > > AchipA wrote: > > > Discussion subject changed to "make validator ignore empty string" by > > Michal Jursa > > > You probably sent your message as a reply to an existing, instead of a > > typing a 'new' message. When you reply, the thread-id remains, so it > > will look funny (=harder to track) for people using threaded mail > > readers or those who follow the group through the web interface. > > > On Apr 7, 4:29 pm, Michal Jursa wrote: > >> What? What have i done wrong? > > >> Michal --~--~-~--~~~---~--~~ 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:19386] Re: Oracle: long text inserting
Yes. Thanks for all your work. Could you email me a summary of your patches? On Apr 7, 8:50 am, SergeyPo wrote: > I hope my today's activity with Oracle testing helps to improve > web2py! > > Model: > > db.define_table('settings', > SQLField('created_at', 'datetime', default=datetime.datetime.now > ()), > SQLField('meta', 'text'), > ) > > Controller action: > > outp = 'Long text longer than 4000 symbols' > db.settings.insert(meta=outp) > > gives error > ORA-01704: string literal too long > > I found a workaround but it should be in gluon eventualy: > > if db._dbname == 'oracle': > cursor = db._connection.cursor() > #cursor.setinputsizes(value = cx_Oracle.CLOB) > cursor.execute("insert into settings(meta) values > (:value)", value = outp) > else: > db.settings.insert(meta=outp) --~--~-~--~~~---~--~~ 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:19387] Re: not unicode
the bottom line is you should use regex to validate postal codes since they may start with 0. On Apr 7, 9:15 am, DenesL wrote: > On Apr 6, 11:01 am, annet wrote: > > > I have got the following model: > > > db.define_table('postcoderegio', > > SQLField('regio', type='integer', length=2, default='', > > notnull=True), > > length is not valid with integer fields > > > SQLField('min', type='integer', length=4, default='', > > notnull=True), > > SQLField('max', type='integer', length=4, default='', > > notnull=True), > > SQLField('provincie', db.provincie, default='', notnull=True, > > ondelete='RESTRICT'), > > migrate=False) > > > db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(00,99),IS_LENGTH(2), > > IS_NOT_EMPTY()] > > same here, IS_LENGTH is invalid with integers (numbers don't have a > length property in Python). > > > db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(,), IS_LENGTH > > (4), IS_NOT_EMPTY()] > > you probably mean db.postcoderegio.min ... > > > db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(,), IS_LENGTH > > (4), IS_NOT_EMPTY()] > > ... and db.postcoderegio.max > (an example of copy/paste/forget-to-fix, it happens to me too) > > > db.postcoderegio.provincie.requires=IS_IN_DB(db, db.provincie.id, '% > > (provincie)s') > > > When I try to insert a record using the appadmin interface I get an > > error on the regio field. The error message reads: not unicode. > > > How do I solve this problem? And what is it's cause? > > > Kind regards, > > > Annet. > > I don't know how postal codes look like over there but Massimo's > suggestion only works if they are exactly 4 digits long and if they > are strings, otherwise you will get the same "Not Unicode" error. --~--~-~--~~~---~--~~ 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:19388] Re: Newbie trying to get the auth role
A user may have membership in groups with multiple roles: for row in db(db.auth_group.id==db.auth_membership.group_id) (db.auth_membership.user_id==auth.user.id).select(db.auth_group.ALL): print row.role On Apr 7, 9:10 am, Monty808 wrote: > Hi, > > I can get the first_name of a user loged in using > first_name=auth.user.first_name. > > I assigned roles to the user. How can I get the role using something > like role=auth.role? > > Thanks --~--~-~--~~~---~--~~ 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:19389] Re: Apache config.
On Apr 7, 9:52 am, zxynax wrote: > I thought that's what you intended. But as I'm the one who's > obviously not understanding something very simple - like the example > in the deployment recipe section - I'm the one waving the idiot banner > and as such have had all powers of assumption revoked. > > Anyway, I have enabled the site that utilizes the WGSI Directives. > I'm able to navigate to the IP associated with the server and view the > welcome page in all it's orange and bold text glory. > > One of the main differences to my config as to the examples is that > Alias Directive line: > "Alias / /home/web2py/applications/" > In my config I have that commented out. As when I have it uncommented > it doesn't allow WSGI to run. > Odd... mine doesn't show the applications just the file list. I've tarred and gzipped my /etc/apache2 directory and put it here: http://www.snipes.org/apache2.tar.gz This is from a test box so nothing important to me in it. Brian --~--~-~--~~~---~--~~ 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:19390] web2py team & Geo/GIS project created at Launchpad
Hello, yesterday I created a web2py team at launchpad. https://launchpad.net/~web2py Please feel free to add yourself to the team. It doesn't mean something special so far. But maybe this can facilitate common development at later stage! Also, I started a project for Geo stuff: web2py Geo & GIS Extensions - https://launchpad.net/web2py-geo My idea is to develop demo & example applications that are using spatial information. Maybe we could grant all team members commit rights to the repository. I will try to develop some blueprints for the above mentioned example applications. I also asked the Launchpad administrators for a project group: https://answers.launchpad.net/launchpad/+question/66678 This could provide a umbrella for us to link all individual projects using web2py together. I hope you appreciate these actions! Regards, Timmie --~--~-~--~~~---~--~~ 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:19391] unable to parse csv file
Hi, I'm using the last web2py release on localhost with python-2.5.4 on a LFS based system. I'm trying to import a CSV file through the web2py interface, I have tried several CVS output,but everytime,I've got the same error which is "unable to parse csv file" Here is the sqlite database created with web2py : db.py : #!/usr/bin/python # -*- coding: utf-8 -*- db = SQLDB('sqlite://bddpackages.db') db.define_table("packages", SQLField("nom","string",length=32,notnull=True,default=""), SQLField ("description","string",length=128,notnull=True,default=""), SQLField("url","string",length=64,notnull=True,default=""), SQLField("packager","string",length=64,default=""), SQLField("categorie","string",length=32,default="")) Here is the CSV file that I have made (a package database), it's the output of (prt-get is a package manager) : $ prt-get printf "\"\",\"%n\",\"%d\",\"%u\",\"%P\",\"cat\"\n" >> /tmp/ db_packages.csv Yes, the first line of this file is written by myself (I saw that line when I have exported a little database made by hand) packages.id,packages.nom,packages.description,packages.url,packages.packager,packages.categorie "","AfterStep","Gestionnaire de fenêtres","http:// www.afterstep.org/","geanbrun","cat" "","ICU","International Components for Unicode for C","http://www.icu- project.org/","","cat" "","LibVNCServer","seveur VNC","http:// libvncserver.sourceforge.net/","floreal.c at orange dot fr","cat" "","MesaLib","OpenGL compatible 3-D graphics library","http:// mesa3d.sourceforge.net","Thierry Nuttens, thierryn1 at hispeed dot ch","cat" "","Mowitz","Librairie pour siag","http://siag.nu/","","cat"; ... ... ... > 1100 lines Maybe because the first ""(packages.id) is empty instead of being "1","2","3","4"... but don't see how to do this automatically. I will be very pleased if someone have a clue. Thanks. ++ fredg --~--~-~--~~~---~--~~ 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:19392] Re: web2py team & Geo/GIS project created at Launchpad
Thank you. On Apr 7, 10:52 am, Timmie wrote: > Hello, > yesterday I created a web2py team at launchpad.https://launchpad.net/~web2py > > Please feel free to add yourself to the team. > It doesn't mean something special so far. But maybe this can > facilitate common development at later stage! > > Also, I started a project for Geo stuff: > web2py Geo & GIS Extensions -https://launchpad.net/web2py-geo > > My idea is to develop demo & example applications that are using > spatial information. > Maybe we could grant all team members commit rights to the repository. > > I will try to develop some blueprints for the above mentioned example > applications. > > I also asked the Launchpad administrators for a project > group:https://answers.launchpad.net/launchpad/+question/66678 > > This could provide a umbrella for us to link all individual projects > using web2py together. > > I hope you appreciate these actions! > > Regards, > Timmie --~--~-~--~~~---~--~~ 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:19393] Re: unable to parse csv file
You should be able ti just delete the "id" column and if there are no dates it should work. On Apr 7, 11:16 am, fredg wrote: > Hi, > > I'm using the last web2py release on localhost with python-2.5.4 on a > LFS based system. > I'm trying to import a CSV file through the web2py interface, I have > tried several CVS output,but everytime,I've got the same error which > is "unable to parse csv file" > > Here is the sqlite database created with web2py : > db.py : > > #!/usr/bin/python > # -*- coding: utf-8 -*- > > db = SQLDB('sqlite://bddpackages.db') > > db.define_table("packages", > SQLField("nom","string",length=32,notnull=True,default=""), > SQLField > ("description","string",length=128,notnull=True,default=""), > SQLField("url","string",length=64,notnull=True,default=""), > SQLField("packager","string",length=64,default=""), > SQLField("categorie","string",length=32,default="")) > > > Here is the CSV file that I have made (a package database), it's the > output of (prt-get is a package manager) : > > $ prt-get printf "\"\",\"%n\",\"%d\",\"%u\",\"%P\",\"cat\"\n" >> /tmp/ > db_packages.csv > > Yes, the first line of this file is written by myself (I saw that line > when I have exported a little database made by hand) > > > packages.id,packages.nom,packages.description,packages.url,packages.packager,packages.categorie > "","AfterStep","Gestionnaire de > fenêtres","http://www.afterstep.org/","geanbrun","cat"; > "","ICU","International Components for Unicode for C","http://www.icu- > project.org/","","cat" > "","LibVNCServer","seveur VNC","http:// > libvncserver.sourceforge.net/","floreal.c at orange dot fr","cat" > "","MesaLib","OpenGL compatible 3-D graphics library","http:// > mesa3d.sourceforge.net","Thierry Nuttens, thierryn1 at hispeed dot > ch","cat" > "","Mowitz","Librairie pour siag","http://siag.nu/","","cat"; > ... > ... > ... > > > > 1100 lines > > Maybe because the first ""(packages.id) is empty instead of being > "1","2","3","4"... but don't see how to do this automatically. > > I will be very pleased if someone have a clue. > > Thanks. > > ++ fredg --~--~-~--~~~---~--~~ 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:19394] Re: unable to parse csv file
> You should be able ti just delete the "id" column and if there are no > dates it should work. Trying with that CSV file (with and without the 1st line) : packages.nom,packages.description,packages.url,packages.packager,packages.categorie "AfterStep","Gestionnaire de fenêtres","http:// www.afterstep.org/","geanbrun","cat" "ICU","International Components for Unicode for C","http://www.icu- project.org/","","cat" "LibVNCServer","seveur VNC","http:// libvncserver.sourceforge.net/","floreal.c at orange dot fr","cat" .. .. No success :( ++ fredg --~--~-~--~~~---~--~~ 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:19395] Web2py doesn't work with embedded jQuery windows
I could be wrong though, so if someone can get shadowbox javascript library to work with web2py, especially the iframe embedded windows, that would be awesome. http://www.mjijackson.com/shadowbox/index.html I have the embedded window working. I.e. I can give it an href of www.google.com, and an embedded window will pop-up with that webpage showing in an iframe in the embedded window. However, if I replace the url with a web2py url, it just forwards the browser to that page. Thanks. --~--~-~--~~~---~--~~ 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:19396] web2py on windows
I trying to get web2py running on vista ultimate which has IIS installed. I can get helloworld.html running on localhost and also from the web using a static ip and port forwarding on my router. However, I cannot get it on another computer on the lan or on the web. My ip address on the lan is 192.168.1.106. When I put this into the web2py startup, I cannot get it on another computer on the lan, only the files in wwwroot in inetpub. Following the instructions on page 210 of the manual, it is a service, but it is not started. I made the service automatic start. However, when I tell it to start, it says it started and then stopped. I tried 0.0.0.0 somewhere in the manual, and I got an error message. Please tell me what the problem is. There should be a separate section on the web2py website for installation problems. I have also had problems getting web2py installed on Linux hosting services. web2py is easy as py, but installation is illusory --~--~-~--~~~---~--~~ 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:19397] Re: Web2py doesn't work with embedded jQuery windows
I noticed that if I enter an href="{{=URL(r=request, c='mycontroller', f='myfunction')}}.html", the embedded window pops-up, however, it is blank because if I manually enter that address, I get invalid function. I wonder if simply setting up a rout that will re-direct the above to just URL(r=request, c='mycontroller', f='myfunction') would work? I am trying this out, however, the manual is unclear as to how to get routes working. It says to put a routes.py file in the web2py folder...the root application folder? I did that and I still can't access the new rout of URL(r=request, c='mycontroller', f='myfunction') + .html in the address bar... On Apr 7, 10:09 am, waTR wrote: > I could be wrong though, so if someone can get shadowbox javascript > library to work with web2py, especially the iframe embedded windows, > that would be awesome.http://www.mjijackson.com/shadowbox/index.html > > I have the embedded window working. I.e. I can give it an href > ofwww.google.com, and an embedded window will pop-up with that webpage > showing in an iframe in the embedded window. However, if I replace the > url with a web2py url, it just forwards the browser to that page. > > Thanks. --~--~-~--~~~---~--~~ 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:19398] Re: web2py on windows
There could be a firewall or there could be another process running on the same port. Try changing the port. On Apr 7, 12:21 pm, davidjensen wrote: > I trying to get web2py running on vista ultimate which has IIS > installed. I can get helloworld.html running on localhost and also > from the web using a static ip and port forwarding on my router. > > However, I cannot get it on another computer on the lan or on the web. > My ip address on the lan is 192.168.1.106. When I put this into the > web2py startup, I cannot get it on another computer on the lan, only > the files in wwwroot in inetpub. Following the instructions on page > 210 of the manual, it is a service, but it is not started. I made the > service automatic start. However, when I tell it to start, it says it > started and then stopped. I tried 0.0.0.0 somewhere in the manual, and > I got an error message. > > Please tell me what the problem is. There should be a separate section > on the web2py website for installation problems. I have also had > problems getting web2py installed on Linux hosting services. web2py is > easy as py, but installation is illusory --~--~-~--~~~---~--~~ 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:19399] Re: Web2py doesn't work with embedded jQuery windows
FIXED!! That was the problem! the embedded window needed an address ending in .html. However, web2py doesn't provide that out of the box (which I think it should, btw, just provide an example routes.py populated with what is needed to take all .html links to the function preceding it). I created a routes.py folder (on OSX it is put under Web2py Contents folder, under Resources <-- this needs to be clearer in the official manual which currently says to just put it under the web2py folder...) Hope anyone needing these embeded windows and needs to know how to get it to work will find this info useful. On Apr 7, 10:30 am, waTR wrote: > I noticed that if I enter an href="{{=URL(r=request, c='mycontroller', > f='myfunction')}}.html", the embedded window pops-up, however, it is > blank because if I manually enter that address, I get invalid > function. I wonder if simply setting up a rout that will re-direct the > above to just URL(r=request, c='mycontroller', f='myfunction') would > work? > > I am trying this out, however, the manual is unclear as to how to get > routes working. It says to put a routes.py file in the web2py > folder...the root application folder? I did that and I still can't > access the new rout of URL(r=request, c='mycontroller', > f='myfunction') + .html in the address bar... > > On Apr 7, 10:09 am, waTR wrote: > > > I could be wrong though, so if someone can get shadowbox javascript > > library to work with web2py, especially the iframe embedded windows, > > that would be awesome.http://www.mjijackson.com/shadowbox/index.html > > > I have the embedded window working. I.e. I can give it an href > > ofwww.google.com, and an embedded window will pop-up with that webpage > > showing in an iframe in the embedded window. However, if I replace the > > url with a web2py url, it just forwards the browser to that page. > > > Thanks. --~--~-~--~~~---~--~~ 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:19400] Re: Web2py doesn't work with embedded jQuery windows
I think your problem is the +".html" below {{=URL(r=request, c='mycontroller',f='myfunction')}}.html It should not be there. On Apr 7, 12:30 pm, waTR wrote: > I noticed that if I enter an href="{{=URL(r=request, c='mycontroller', > f='myfunction')}}.html", the embedded window pops-up, however, it is > blank because if I manually enter that address, I get invalid > function. I wonder if simply setting up a rout that will re-direct the > above to just URL(r=request, c='mycontroller', f='myfunction') would > work? > > I am trying this out, however, the manual is unclear as to how to get > routes working. It says to put a routes.py file in the web2py > folder...the root application folder? I did that and I still can't > access the new rout of URL(r=request, c='mycontroller', > f='myfunction') + .html in the address bar... > > On Apr 7, 10:09 am, waTR wrote: > > > I could be wrong though, so if someone can get shadowbox javascript > > library to work with web2py, especially the iframe embedded windows, > > that would be awesome.http://www.mjijackson.com/shadowbox/index.html > > > I have the embedded window working. I.e. I can give it an href > > ofwww.google.com, and an embedded window will pop-up with that webpage > > showing in an iframe in the embedded window. However, if I replace the > > url with a web2py url, it just forwards the browser to that page. > > > Thanks. --~--~-~--~~~---~--~~ 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:19401] Re: unable to parse csv file
What error do you get? Here are some other possible causes of errors: - There are column names that do have a corresponding field in the table - field types do not match - you have dates NOT in ISO format - you have special characters in the strings (I see you have a "ê"). Strings must be UTF8 to be imported. Massimo On Apr 7, 12:06 pm, fredg wrote: > > You should be able ti just delete the "id" column and if there are no > > dates it should work. > > Trying with that CSV file (with and without the 1st line) : > > packages.nom,packages.description,packages.url,packages.packager,packages.categorie > "AfterStep","Gestionnaire de > fenêtres","http://www.afterstep.org/","geanbrun","cat"; > "ICU","International Components for Unicode for C","http://www.icu- > project.org/","","cat" > "LibVNCServer","seveur VNC","http:// > libvncserver.sourceforge.net/","floreal.c at orange dot fr","cat" > .. > .. > > No success :( > > ++ fredg --~--~-~--~~~---~--~~ 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:19402] Re: web2py on windows
Suggest David to paste his command line to start web2py and the console output, to make sure no simple typo inside. By the way, can web2py provide useful information now, when port not available? We mentioned that. http://groups.google.com/group/web2py/browse_frm/thread/76c1751a01bf8d5d On Apr8, 1:47am, mdipierro wrote: > There could be a firewall or there could be another process running on > the same port. Try changing the port. > > On Apr 7, 12:21 pm, davidjensen wrote: > > > I trying to get web2py running on vista ultimate which has IIS > > installed. I can get helloworld.html running on localhost and also > > from the web using a static ip and port forwarding on my router. > > > However, I cannot get it on another computer on the lan or on the web. > > My ip address on the lan is 192.168.1.106. When I put this into the > > web2py startup, I cannot get it on another computer on the lan, only > > the files in wwwroot in inetpub. Following the instructions on page > > 210 of the manual, it is a service, but it is not started. I made the > > service automatic start. However, when I tell it to start, it says it > > started and then stopped. I tried 0.0.0.0 somewhere in the manual, and > > I got an error message. > > > Please tell me what the problem is. There should be a separate section > > on the web2py website for installation problems. I have also had > > problems getting web2py installed on Linux hosting services. web2py is > > easy as py, but installation is illusory --~--~-~--~~~---~--~~ 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:19413] Re: Web2py doesn't work with embedded jQuery windows
Please post t on AlterEgo and I'll approve it On Apr 7, 1:59 pm, waTR wrote: > The problem was web2py was not serving files ending in .html to the > browser. All I needed to do to get shadowbox running with web2py was > create a routes.py that added .html to all web2py URLs. > > Here is the routes.py file contents that fixed the problem. My > routes.py file now creates a URL followed by .html, which is needed > for the whole thing to work with the shadowbox library (and any other > javascript library). > > On OSX: > web2py/Contents/Resources/routes.py > routes_in=( >('/$c/$f.html','/tripplanet/$c/$f'), >('/$c/$f','/tripplanet/$c/$f'), >) > > routes_out=( > ('/tripplanet/$c/$f','/$c/$f.html'), > ) > > Thats it. Now any time you put URL(r=request, f='function'). The > resulting url is yoursite/controller/function.html. Note that the url > no longer includes the app name. > i.e. yoursite/appname/controller/function.html. > > Also, if you type in that address it keeps it in the address bar > without transforming it to the same without the .html. > > Lastly, the app can be still reached by typing the info without > the .html. i.e. yoursite/controller/function (no .html). > > THIS NEEDS TO GO ON THE WIKI AS A TUTORIAL ON HOW TO GET SHADOWBOX > RUNNGIN WITH WEB2PY! > > On Apr 7, 10:49 am, mdipierro wrote: > > > I think your problem is the +".html" below > > > {{=URL(r=request, c='mycontroller',f='myfunction')}}.html > > > It should not be there. > > > On Apr 7, 12:30 pm, waTR wrote: > > > > I noticed that if I enter an href="{{=URL(r=request, c='mycontroller', > > > f='myfunction')}}.html", the embedded window pops-up, however, it is > > > blank because if I manually enter that address, I get invalid > > > function. I wonder if simply setting up a rout that will re-direct the > > > above to just URL(r=request, c='mycontroller', f='myfunction') would > > > work? > > > > I am trying this out, however, the manual is unclear as to how to get > > > routes working. It says to put a routes.py file in the web2py > > > folder...the root application folder? I did that and I still can't > > > access the new rout of URL(r=request, c='mycontroller', > > > f='myfunction') + .html in the address bar... > > > > On Apr 7, 10:09 am, waTR wrote: > > > > > I could be wrong though, so if someone can get shadowbox javascript > > > > library to work with web2py, especially the iframe embedded windows, > > > > that would be awesome.http://www.mjijackson.com/shadowbox/index.html > > > > > I have the embedded window working. I.e. I can give it an href > > > > ofwww.google.com, and an embedded window will pop-up with that webpage > > > > showing in an iframe in the embedded window. However, if I replace the > > > > url with a web2py url, it just forwards the browser to that page. > > > > > Thanks. --~--~-~--~~~---~--~~ 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:19414] Re: unable to parse csv file
Because if appadmin were to give a ticket people would interpret this as a web2py (appamdin) bug. If you call db.youtable.import_from_csv_file(open(,'rb')) and it fails, this will give you a ticket. Massimo On Apr 7, 1:19 pm, fredg wrote: > > What error do you get? > > I don' t have any ticket just the red warning. > Is there a log file where I can find something useful for you ? > > > Here are some other possible causes of errors: > > - There are column names that do have a corresponding field in the > > table > > - field types do not match > > - you have dates NOT in ISO format > > - you have special characters in the strings (I see you have a "ê"). > > Strings must be UTF8 to be imported. > > I have changed string to text, remove special characters from desc. > (stup** frenchies :P), remove the not null condition, no dates. > Here is the new db .py > > #!/usr/bin/python > # -*- coding: utf-8 -*- > > db = SQLDB('sqlite://bddpackages.db') > > ## Table des Packages > db.define_table("packages", > SQLField("nom","text",length=32,notnull=True,default=""), > SQLField("description","text",length=128,default=""), > SQLField("url","text",length=64,default=""), > SQLField("packager","text",length=64,default=""), > SQLField("categorie","text",length=32,default="")) > > > The new CSV file looks like that : > packages.nom,packages.description,packages.url,packages.packager,packages.categorie > "AfterStep","desc","http://www.afterstep.org/","geanbrun","cat"; > "ICU","desc","http://www.icu-project.org/","","cat"; > "LibVNCServer","desc","http:// > libvncserver.sourceforge.net/","floreal.c at orange dot fr","cat" > "MesaLib","desc","http://mesa3d.sourceforge.net","Thierry Nuttens, > thierryn1 at hispeed dot ch","cat" > .. > .. > > I 've got the same warning "unable to parse CSV file", but this time > only 51 packages were added to the db. > I will check line by line if there is a special character > somewhere ... > > Best regards. > > ++ fredg --~--~-~--~~~---~--~~ 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:19404] Re: unable to parse csv file
> What error do you get? I don' t have any ticket just the red warning. Is there a log file where I can find something useful for you ? > Here are some other possible causes of errors: > - There are column names that do have a corresponding field in the > table > - field types do not match > - you have dates NOT in ISO format > - you have special characters in the strings (I see you have a "ê"). > Strings must be UTF8 to be imported. I have changed string to text, remove special characters from desc. (stup** frenchies :P), remove the not null condition, no dates. Here is the new db .py #!/usr/bin/python # -*- coding: utf-8 -*- db = SQLDB('sqlite://bddpackages.db') ## Table des Packages db.define_table("packages", SQLField("nom","text",length=32,notnull=True,default=""), SQLField("description","text",length=128,default=""), SQLField("url","text",length=64,default=""), SQLField("packager","text",length=64,default=""), SQLField("categorie","text",length=32,default="")) The new CSV file looks like that : packages.nom,packages.description,packages.url,packages.packager,packages.categorie "AfterStep","desc","http://www.afterstep.org/","geanbrun","cat"; "ICU","desc","http://www.icu-project.org/","","cat"; "LibVNCServer","desc","http:// libvncserver.sourceforge.net/","floreal.c at orange dot fr","cat" "MesaLib","desc","http://mesa3d.sourceforge.net","Thierry Nuttens, thierryn1 at hispeed dot ch","cat" .. .. I 've got the same warning "unable to parse CSV file", but this time only 51 packages were added to the db. I will check line by line if there is a special character somewhere ... Best regards. ++ fredg --~--~-~--~~~---~--~~ 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:19408] Re: The official Web2py Book by Massimo....for free?
On Sun, 5 Apr 2009 17:08:31 -0700 (PDT), richar...@gmail.com said: > And my version is > fast becoming out of date with all the new features. This is not a complaint - I do not expect the book to be free - but the above point is valid. I too have the printed book, but a lot has changed since it was written. Some projects (the Claws Mail project springs to mind) include a list of new features with each release. Would that be something that web2py could do? Keith --~--~-~--~~~---~--~~ 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:19403] Re: WARNING:root:unable to import dbhash (only from external cron)
Just a couple more data points in case they are useful. The -R was indeed unnecessary in the crontab, but it doesn't seem to be the cause of the problem, as db.commit() is still required in order to successfully insert into the database. Also, running the web2py shell (-M -S appname) also requires a db.commit() in order to update the db. Thanks again, -Seth On Apr 4, 8:23 am, mdipierro wrote: > The -R may be causing the problem. Running scripts instead of action > requires manual committing the db. > > On Apr 4, 5:40 am, AchipA wrote: > > > BTW Just out of curiosity, why are you calling -R ...test.py in your > > crontab ? It looks fairly redundant to me (you should call it within > > appname'scron/crontab). > > > 0-59/1 * * * * cd /Users/username/Desktop/appname/web2py && python > > web2py.py -R applications/appname/controllers/test.py -C -D 1 >> /tmp/ > >cron.output 2>&1 > > > On Apr 3, 1:29 am, seth wrote: > > > > I'm having trouble doing a db.table.insert from anexternalcronon > > > macosx. > > > > The systemcronfile > > > > 0-59/1 * * * * cd /Users/username/Desktop/appname/web2py && python > > > web2py.py -R applications/appname/controllers/test.py -C -D 1 >> /tmp/ > > >cron.output 2>&1 > > > > The crontab file in appname/crondirectory > > > > */10 * * * * root *test/callcron > > > > I can see the callcron method is successfully being called every ten > > > minutes from thecron.output file. > > > > But, incron.output I get the following error > > > WARNING:root:unable to import dbhash > > > > and none of the db.table.inserts put anything in the database. > > > Although, when I hit the controller/action via the URL everything > > > works fine and I get entries in the database. > > > > I've also tried the -S appname and -M switches, with no changes. > > > > I've followed the following posts > > > >http://groups.google.com/group/web2py/browse_thread/thread/cfe89bfa9d... > > > > and > > > >http://groups.google.com/group/web2py/browse_thread/thread/9acf0aae73... > > > > with the same results. > > > > I'm new to web2py so I may be missing something obvious :) > > > > Thanks in advance, > > > -Seth --~--~-~--~~~---~--~~ 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:19415] global controller?
I am learning all the new auth, crud, and mail tools now, and I have one question: Does web2py use the 'default' controller as an implicit global controller across a single application, or is that even possible? Here is my situation. When I create my: ## default.py controller def user(): return dict(form = auth()) Then I expose: ## request application/default/user/login Which is not as clean in terms of MVC, because I in effect have an additional (virtual) controller (named 'user') created, which then calls the function 'login'. Ideally, I would like: ## request application/user/login ...to expose the function, which would require treating 'default' as a global controller, as it were. I tried creating a 'login' controller, but the request still required an extra term in the request (app/login/ user/login) - not pretty. I hate to say Rails does something like this with the 'application' controller, because any code in that file is global to the app. I guess what I am looking for is web2py to look in the 'default' controller first if any parsed controller/function candidate can not be found, and only then raise the error on failure. That way we can have a simpler request syntax (more RESTful), and the result would be a good fit in the case of auth, crud, and mail, because these are usually site-wide administrative functions anyway. Programming is fun again, thanks to web2py! --~--~-~--~~~---~--~~ 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:19407] Re: Apache config.
On Apr 7, 1:32 pm, zxynax wrote: > So I found a workaround. Great! > > The problem I have with this is I'd like to manipulate the xml > contained within the .svg with web2py. > > Is an email to the author in order? Not a clue. I've never touched WSGI before last night :) Brian --~--~-~--~~~---~--~~ 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:19405] Re: Apache config.
I uncommented the alias line and it now serves SVG. Problem is that none of the web2py code runs. On Apr 7, 10:31 am, bsnipes wrote: > On Apr 7, 9:52 am, zxynax wrote: > > > I thought that's what you intended. But as I'm the one who's > > obviously not understanding something very simple - like the example > > in the deployment recipe section - I'm the one waving the idiot banner > > and as such have had all powers of assumption revoked. > > > Anyway, I have enabled the site that utilizes the WGSI Directives. > > I'm able to navigate to the IP associated with the server and view the > > welcome page in all it's orange and bold text glory. > > > One of the main differences to my config as to the examples is that > > Alias Directive line: > > "Alias / /home/web2py/applications/" > > In my config I have that commented out. As when I have it uncommented > > it doesn't allow WSGI to run. > > Odd... mine doesn't show the applications just the file list. I've > tarred and gzipped my /etc/apache2 directory and put it here: > > http://www.snipes.org/apache2.tar.gz > > This is from a test box so nothing important to me in it. > > Brian --~--~-~--~~~---~--~~ 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:19416] Re: global controller?
You can do what you are talking about via routes.py. I believe this will do it: routes_in=( ('/yourapp/default/$f.html','/yourapp/$f'), ) On Apr 7, 12:44 pm, g-man wrote: > I am learning all the new auth, crud, and mail tools now, and I have > one question: > > Does web2py use the 'default' controller as an implicit global > controller across a single application, or is that even possible? > > Here is my situation. When I create my: > > ## default.py controller > def user(): > return dict(form = auth()) > > Then I expose: > > ## request > application/default/user/login > > Which is not as clean in terms of MVC, because I in effect have an > additional (virtual) controller (named 'user') created, which then > calls the function 'login'. > > Ideally, I would like: > > ## request > application/user/login > > ...to expose the function, which would require treating 'default' as a > global controller, as it were. I tried creating a 'login' controller, > but the request still required an extra term in the request (app/login/ > user/login) - not pretty. > > I hate to say Rails does something like this with the 'application' > controller, because any code in that file is global to the app. > > I guess what I am looking for is web2py to look in the 'default' > controller first if any parsed controller/function candidate can not > be found, and only then raise the error on failure. > > That way we can have a simpler request syntax (more RESTful), and the > result would be a good fit in the case of auth, crud, and mail, > because these are usually site-wide administrative functions anyway. > > Programming is fun again, thanks to web2py! --~--~-~--~~~---~--~~ 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:19409] Re: Web2py doesn't work with embedded jQuery windows
The problem was web2py was not serving files ending in .html to the browser. All I needed to do to get shadowbox running with web2py was create a routes.py that added .html to all web2py URLs. Here is the routes.py file contents that fixed the problem. My routes.py file now creates a URL followed by .html, which is needed for the whole thing to work with the shadowbox library (and any other javascript library). On OSX: web2py/Contents/Resources/routes.py routes_in=( ('/$c/$f.html','/tripplanet/$c/$f'), ('/$c/$f','/tripplanet/$c/$f'), ) routes_out=( ('/tripplanet/$c/$f','/$c/$f.html'), ) Thats it. Now any time you put URL(r=request, f='function'). The resulting url is yoursite/controller/function.html. Note that the url no longer includes the app name. i.e. yoursite/appname/controller/function.html. Also, if you type in that address it keeps it in the address bar without transforming it to the same without the .html. Lastly, the app can be still reached by typing the info without the .html. i.e. yoursite/controller/function (no .html). THIS NEEDS TO GO ON THE WIKI AS A TUTORIAL ON HOW TO GET SHADOWBOX RUNNGIN WITH WEB2PY! On Apr 7, 10:49 am, mdipierro wrote: > I think your problem is the +".html" below > > {{=URL(r=request, c='mycontroller',f='myfunction')}}.html > > It should not be there. > > On Apr 7, 12:30 pm, waTR wrote: > > > I noticed that if I enter an href="{{=URL(r=request, c='mycontroller', > > f='myfunction')}}.html", the embedded window pops-up, however, it is > > blank because if I manually enter that address, I get invalid > > function. I wonder if simply setting up a rout that will re-direct the > > above to just URL(r=request, c='mycontroller', f='myfunction') would > > work? > > > I am trying this out, however, the manual is unclear as to how to get > > routes working. It says to put a routes.py file in the web2py > > folder...the root application folder? I did that and I still can't > > access the new rout of URL(r=request, c='mycontroller', > > f='myfunction') + .html in the address bar... > > > On Apr 7, 10:09 am, waTR wrote: > > > > I could be wrong though, so if someone can get shadowbox javascript > > > library to work with web2py, especially the iframe embedded windows, > > > that would be awesome.http://www.mjijackson.com/shadowbox/index.html > > > > I have the embedded window working. I.e. I can give it an href > > > ofwww.google.com, and an embedded window will pop-up with that webpage > > > showing in an iframe in the embedded window. However, if I replace the > > > url with a web2py url, it just forwards the browser to that page. > > > > Thanks. --~--~-~--~~~---~--~~ 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:19412] Re: Apache config.
On Apr 7, 1:59 pm, zxynax wrote: > That begs the question - what deployment method are you using? > It will be on Apache. Right now I am creating my first actual site. --~--~-~--~~~---~--~~ 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:19411] Re: The official Web2py Book by Massimo....for free?
and another one: http://www.jjude.com/2009/04/07/why-i-chose-web2py-for-developing-yatsy/ On 6 avr, 22:16, desfrenes wrote: > On 6 avr, 22:01, g-man wrote: > > > Where are all the web2py blogs and articles, people? > > here's > one:http://www.desfrenes.com/blog/post/quel-framework-web-python-choisir > :-) --~--~-~--~~~---~--~~ 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:19406] Re: Apache config.
So I found a workaround. The alias directive should be as follows: "Alias / //applications//static/" This allows the web2py code to run properly and still allow .svg images to be correctly given to the client with the proper image/svg +xml header. The problem I have with this is I'd like to manipulate the xml contained within the .svg with web2py. Is an email to the author in order? On Apr 7, 1:21 pm, zxynax wrote: > I uncommented the alias line and it now serves SVG. > Problem is that none of the web2py code runs. > > On Apr 7, 10:31 am, bsnipes wrote: > > > > > On Apr 7, 9:52 am, zxynax wrote: > > > > I thought that's what you intended. But as I'm the one who's > > > obviously not understanding something very simple - like the example > > > in the deployment recipe section - I'm the one waving the idiot banner > > > and as such have had all powers of assumption revoked. > > > > Anyway, I have enabled the site that utilizes the WGSI Directives. > > > I'm able to navigate to the IP associated with the server and view the > > > welcome page in all it's orange and bold text glory. > > > > One of the main differences to my config as to the examples is that > > > Alias Directive line: > > > "Alias / /home/web2py/applications/" > > > In my config I have that commented out. As when I have it uncommented > > > it doesn't allow WSGI to run. > > > Odd... mine doesn't show the applications just the file list. I've > > tarred and gzipped my /etc/apache2 directory and put it here: > > >http://www.snipes.org/apache2.tar.gz > > > This is from a test box so nothing important to me in it. > > > Brian- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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:19410] Re: Apache config.
That begs the question - what deployment method are you using? On Apr 7, 1:39 pm, bsnipes wrote: > On Apr 7, 1:32 pm, zxynax wrote: > > > So I found a workaround. > > Great! > > > > > The problem I have with this is I'd like to manipulate the xml > > contained within the .svg with web2py. > > > Is an email to the author in order? > > Not a clue. I've never touched WSGI before last night :) > > Brian --~--~-~--~~~---~--~~ 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:19417] Re: Web2py doesn't work with embedded jQuery windows
Awaiting approval. Called "How to use shadowbox with web2py". Cheers. On Apr 7, 12:32 pm, mdipierro wrote: > Please post t on AlterEgo and I'll approve it > > On Apr 7, 1:59 pm, waTR wrote: > > > The problem was web2py was not serving files ending in .html to the > > browser. All I needed to do to get shadowbox running with web2py was > > create a routes.py that added .html to all web2py URLs. > > > Here is the routes.py file contents that fixed the problem. My > > routes.py file now creates a URL followed by .html, which is needed > > for the whole thing to work with the shadowbox library (and any other > > javascript library). > > > On OSX: > > web2py/Contents/Resources/routes.py > > routes_in=( > > ('/$c/$f.html','/tripplanet/$c/$f'), > > ('/$c/$f','/tripplanet/$c/$f'), > > ) > > > routes_out=( > > ('/tripplanet/$c/$f','/$c/$f.html'), > > ) > > > Thats it. Now any time you put URL(r=request, f='function'). The > > resulting url is yoursite/controller/function.html. Note that the url > > no longer includes the app name. > > i.e. yoursite/appname/controller/function.html. > > > Also, if you type in that address it keeps it in the address bar > > without transforming it to the same without the .html. > > > Lastly, the app can be still reached by typing the info without > > the .html. i.e. yoursite/controller/function (no .html). > > > THIS NEEDS TO GO ON THE WIKI AS A TUTORIAL ON HOW TO GET SHADOWBOX > > RUNNGIN WITH WEB2PY! > > > On Apr 7, 10:49 am, mdipierro wrote: > > > > I think your problem is the +".html" below > > > > {{=URL(r=request, c='mycontroller',f='myfunction')}}.html > > > > It should not be there. > > > > On Apr 7, 12:30 pm, waTR wrote: > > > > > I noticed that if I enter an href="{{=URL(r=request, c='mycontroller', > > > > f='myfunction')}}.html", the embedded window pops-up, however, it is > > > > blank because if I manually enter that address, I get invalid > > > > function. I wonder if simply setting up a rout that will re-direct the > > > > above to just URL(r=request, c='mycontroller', f='myfunction') would > > > > work? > > > > > I am trying this out, however, the manual is unclear as to how to get > > > > routes working. It says to put a routes.py file in the web2py > > > > folder...the root application folder? I did that and I still can't > > > > access the new rout of URL(r=request, c='mycontroller', > > > > f='myfunction') + .html in the address bar... > > > > > On Apr 7, 10:09 am, waTR wrote: > > > > > > I could be wrong though, so if someone can get shadowbox javascript > > > > > library to work with web2py, especially the iframe embedded windows, > > > > > that would be awesome.http://www.mjijackson.com/shadowbox/index.html > > > > > > I have the embedded window working. I.e. I can give it an href > > > > > ofwww.google.com, and an embedded window will pop-up with that webpage > > > > > showing in an iframe in the embedded window. However, if I replace the > > > > > url with a web2py url, it just forwards the browser to that page. > > > > > > Thanks. --~--~-~--~~~---~--~~ 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:19418] T2 + storing user session info
I am using the t2.logged_in variable to store the status of my user. When the user logs in, the function changes the t2.logged_in = True. However, when I then check t2.logged_in in another controller and another page, t2.logged_in = False. Whats going on? It seems t2.logged_in is not keeping track of the session or something... is there a way to pass a session to it? How do I do this? --~--~-~--~~~---~--~~ 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:19419] Re: global controller?
You can do: index_url=URL(r=request,f=index') def login(): return dict(form = auth.login(next=index_url)) def register(): return dict(form = auth.register(next=index_url)) ... etc. Massimo On Apr 7, 2:44 pm, g-man wrote: > I am learning all the new auth, crud, and mail tools now, and I have > one question: > > Does web2py use the 'default' controller as an implicit global > controller across a single application, or is that even possible? > > Here is my situation. When I create my: > > ## default.py controller > def user(): > return dict(form = auth()) > > Then I expose: > > ## request > application/default/user/login > > Which is not as clean in terms of MVC, because I in effect have an > additional (virtual) controller (named 'user') created, which then > calls the function 'login'. > > Ideally, I would like: > > ## request > application/user/login > > ...to expose the function, which would require treating 'default' as a > global controller, as it were. I tried creating a 'login' controller, > but the request still required an extra term in the request (app/login/ > user/login) - not pretty. > > I hate to say Rails does something like this with the 'application' > controller, because any code in that file is global to the app. > > I guess what I am looking for is web2py to look in the 'default' > controller first if any parsed controller/function candidate can not > be found, and only then raise the error on failure. > > That way we can have a simpler request syntax (more RESTful), and the > result would be a good fit in the case of auth, crud, and mail, > because these are usually site-wide administrative functions anyway. > > Programming is fun again, thanks to web2py! --~--~-~--~~~---~--~~ 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:19420] Re: T2 + storing user session info
try {{=session}} to see what is going on Is it possible you create the t2 object in the controller and not in the model? I think there is also a variable session.t2_person_id that you can use for the check. Massimo On Apr 7, 3:50 pm, waTR wrote: > I am using the t2.logged_in variable to store the status of my user. > > When the user logs in, the function changes the t2.logged_in = True. > > However, when I then check t2.logged_in in another controller and > another page, t2.logged_in = False. Whats going on? It seems > t2.logged_in is not keeping track of the session or something... is > there a way to pass a session to it? > > How do I do this? --~--~-~--~~~---~--~~ 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:19421] Re: Apache config.
Just came across this nice post and am going to try it tonight: http://groups.google.com/group/web2py/browse_thread/thread/8bab53777c1b1587/ddf09d126685fd7f?lnk=gst&q=apache#ddf09d126685fd7f Brian --~--~-~--~~~---~--~~ 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:19422] Re: T2 + storing user session info
my model has the following for T2: from applications.plugin_t2.modules.t2 import T2 t2=T2(request,response,session,cache,T,db) session.t2_person_id prints "NONE" am I missing something? Here is my code logic: check if username & password are correct. if they are, then set t2.logged_in = True and redirect to userhome. However, once at userhome.html {{=session.t2_person_id}} prints "NONE". I think I need an explination of how to use T2 without the helpers for the login form and such. What variables do I need to ensure I store data in to use T2's features? Thanks for the quick reply! On Apr 7, 2:00 pm, mdipierro wrote: > try {{=session}} to see what is going on > > Is it possible you create the t2 object in the controller and not in > the model? > > I think there is also a variable session.t2_person_id that you can > use for the check. > > Massimo > > On Apr 7, 3:50 pm, waTR wrote: > > > I am using the t2.logged_in variable to store the status of my user. > > > When the user logs in, the function changes the t2.logged_in = True. > > > However, when I then check t2.logged_in in another controller and > > another page, t2.logged_in = False. Whats going on? It seems > > t2.logged_in is not keeping track of the session or something... is > > there a way to pass a session to it? > > > How do I do this? --~--~-~--~~~---~--~~ 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:19423] Idea for class / system?
I read in a thread a while back about possible inclusion of ready-made app classes and modules in web2py - I couldn't locate it so I figured I would add it here. A shopping cart class would be fantastic! Something that would allow developers to build either cart-enabled websites, or shopping cart software. I've noticed a lack of information on the web about actually developing a shopping cart. And, this could be a great marketing/sales tool for web2py. Roll your own cart with your own features, easily. Just a thought! --~--~-~--~~~---~--~~ 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:19424] Re: Idea for class / system?
Did you look into the eStore app on http://www.web2py.com/appliances ? It needs some more work but it is decent. Massimo On Apr 7, 4:32 pm, Michael wrote: > I read in a thread a while back about possible inclusion of ready-made > app classes and modules in web2py - I couldn't locate it so I figured > I would add it here. > > A shopping cart class would be fantastic! > > Something that would allow developers to build either cart-enabled > websites, or shopping cart software. > > I've noticed a lack of information on the web about actually > developing a shopping cart. And, this could be a great marketing/sales > tool for web2py. Roll your own cart with your own features, easily. > > Just a thought! --~--~-~--~~~---~--~~ 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:19425] Re: Apache config.
That is the setup I use. On Apr 7, 4:19 pm, bsnipes wrote: > Just came across this nice post and am going to try it tonight: > > http://groups.google.com/group/web2py/browse_thread/thread/8bab53777c... > > Brian --~--~-~--~~~---~--~~ 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:19426] BUG or I just don't understand how it works
CODE: form=FORM(TABLE(TR("Your name:",INPUT (_type="text",_name="name",requires=IS_NOT_EMPTY(), _class="frm_field")), TR("Your email:",INPUT (_type="text",_name="email",requires=IS_EMAIL(), _class="frm_field")), TR("Subject",INPUT (_name="subject",requires=IS_NOT_EMPTY(), _class="frm_field")), TR("Department",SELECT('Select One','General Mailbox','Support','Webmaster','Billing','Investor Relations',_name="department", _value="Select One", requires=IS_IN_SET (['General Mailbox','Support','Webmaster','Billing','Investor Relations']), _class="frm_field")), TR("Message",TEXTAREA (_name="message",requires=IS_NOT_EMPTY(), _class="frm_txtbox"), _class="frm_field"), TR("", INPUT(_type="submit",_value="Send", _class="form_btn"), _class="aright"), _class="frm_tbl"), _action="URL (r=request, c='comm', f='esend')", _method="post") The FORM(_action="") won't accept a URL() for some reason... I have tried doing {{URL()}}, {{=URL}}, etc. nothing seems to work... BUG or Me ? --~--~-~--~~~---~--~~ 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:19427] IS_PASS_MATCH or IS_MATCH validator
I am looking to write a validator that takes as its arguments a request.post_vars.pass1 and request.post_vars.pass2. This is to check if when the use enters a password in 2 fields that they are the same. It then checks if they match, and if they don't it flashes an error saying passwords do not match. In addition, two questions: 1. Where should I store this custom validator? 2. How do I import this custom validator to use in my controller? Here is the code I have so far: from storage import Storage from gluon.utils import md5_hash class IS_PASS_MATCH(object): """ example: INPUT(_type='text',_name='pass1',requires=IS_NOT_EMPTY()) INPUT(_type='text',_name='pass2',requires=IS_PASS_MATCH (request.post_vars.pass1, request.post_vars.pass2)) """ def __init__(self, passwd1, passwd2, error_message='Passwords do not match!'): self.error_message = error_message self.pass1 = passwd1 self.pass2 = passwd2 def __call__(self, value): try: if(self.pass1 == self.pass2): return(value, None) else: return (value, self.error_message) except: return (value, self.error_message) --~--~-~--~~~---~--~~ 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:19428] Re: BUG or I just don't understand how it works
This is not in a view therefore you should do form=FORM(, _action=URL(r=request, c='comm', f='esend'), _method="post") Massimo On Apr 7, 5:58 pm, waTR wrote: > CODE: > form=FORM(TABLE(TR("Your name:",INPUT > (_type="text",_name="name",requires=IS_NOT_EMPTY(), > _class="frm_field")), > TR("Your email:",INPUT > (_type="text",_name="email",requires=IS_EMAIL(), _class="frm_field")), > TR("Subject",INPUT > (_name="subject",requires=IS_NOT_EMPTY(), _class="frm_field")), > TR("Department",SELECT('Select One','General > Mailbox','Support','Webmaster','Billing','Investor > Relations',_name="department", _value="Select One", requires=IS_IN_SET > (['General Mailbox','Support','Webmaster','Billing','Investor > Relations']), _class="frm_field")), > TR("Message",TEXTAREA > (_name="message",requires=IS_NOT_EMPTY(), _class="frm_txtbox"), > _class="frm_field"), > TR("", INPUT(_type="submit",_value="Send", > _class="form_btn"), _class="aright"), _class="frm_tbl"), _action="URL > (r=request, c='comm', f='esend')", _method="post") > > The FORM(_action="") won't accept a URL() for some reason... I have > tried doing {{URL()}}, {{=URL}}, etc. nothing seems to work... > > BUG or Me ? --~--~-~--~~~---~--~~ 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:19429] Re: IS_PASS_MATCH or IS_MATCH validator
I just do FORM(INPUT(_name='pass1'),INPUT(_name='pass2', requires=IS_EXPR ('value==%s' % repr(request.vars.pass1)),INPUT(_type='submit')) On Apr 7, 6:37 pm, waTR wrote: > I am looking to write a validator that takes as its arguments a > request.post_vars.pass1 and request.post_vars.pass2. This is to check > if when the use enters a password in 2 fields that they are the same. > > It then checks if they match, and if they don't it flashes an error > saying passwords do not match. > > In addition, two questions: > 1. Where should I store this custom validator? > 2. How do I import this custom validator to use in my controller? > > Here is the code I have so far: > > from storage import Storage > from gluon.utils import md5_hash > > class IS_PASS_MATCH(object): > """ > example: > INPUT(_type='text',_name='pass1',requires=IS_NOT_EMPTY()) > INPUT(_type='text',_name='pass2',requires=IS_PASS_MATCH > (request.post_vars.pass1, request.post_vars.pass2)) > """ > > def __init__(self, passwd1, passwd2, error_message='Passwords do > not match!'): > self.error_message = error_message > self.pass1 = passwd1 > self.pass2 = passwd2 > > def __call__(self, value): > try: > if(self.pass1 == self.pass2): > return(value, None) > else: > return (value, self.error_message) > except: > return (value, self.error_message) --~--~-~--~~~---~--~~ 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:19430] Re: IS_PASS_MATCH or IS_MATCH validator
That's definetly better than what I was going to do :) Thanks for the quick response! On Apr 7, 4:56 pm, mdipierro wrote: > I just do > > FORM(INPUT(_name='pass1'),INPUT(_name='pass2', requires=IS_EXPR > ('value==%s' % repr(request.vars.pass1)),INPUT(_type='submit')) > > On Apr 7, 6:37 pm, waTR wrote: > > > I am looking to write a validator that takes as its arguments a > > request.post_vars.pass1 and request.post_vars.pass2. This is to check > > if when the use enters a password in 2 fields that they are the same. > > > It then checks if they match, and if they don't it flashes an error > > saying passwords do not match. > > > In addition, two questions: > > 1. Where should I store this custom validator? > > 2. How do I import this custom validator to use in my controller? > > > Here is the code I have so far: > > > from storage import Storage > > from gluon.utils import md5_hash > > > class IS_PASS_MATCH(object): > > """ > > example: > > INPUT(_type='text',_name='pass1',requires=IS_NOT_EMPTY()) > > INPUT(_type='text',_name='pass2',requires=IS_PASS_MATCH > > (request.post_vars.pass1, request.post_vars.pass2)) > > """ > > > def __init__(self, passwd1, passwd2, error_message='Passwords do > > not match!'): > > self.error_message = error_message > > self.pass1 = passwd1 > > self.pass2 = passwd2 > > > def __call__(self, value): > > try: > > if(self.pass1 == self.pass2): > > return(value, None) > > else: > > return (value, self.error_message) > > except: > > return (value, self.error_message) --~--~-~--~~~---~--~~ 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:19431] Re: The official Web2py Book by Massimo....for free?
> stop blaming him for that silly 'problem' you can solve for $10. FYI I have already bought the book. You are right that it is a trivial amount for someone who is already convinced of the benefits of web2py. However it is an obstacle for beginners who are evaluating web2py while the free documentation is not ready. Also the book is getting out of date. Massimo said selling the book is not motivated by profit and he was looking for a way to simultaneously give it away anyway, just he couldn't find the right publisher. Apress permitted this arrangement for the Django Project so it should be possible for web2py too. Baron On Apr 7, 11:18 am, Michal Jursa wrote: > HEY PEOPLE! > Stop blaming Massimo for nonfree book! > > He wrote the book, he is owner of all rights, copyrights etc. and it is > absolutely on him if he will or will not let it go for free. He > explained so many times it is not his job to sell the book but he has > some reasons to do that and it is not only on him. Accept it or not, but > let Massimo live and breath. He is doing GREAT job, spends a lot of time > with you all, working on web2py, answering questions, fixing bugs etc > etc. So stop blaming him for that silly 'problem' you can solve for $10. > If you are really seriously interested in web2py then this is not price > to stop you. I bought the book and i'm absolutely happy with it and i > know i'm not alone. > > Michal alias Plysak > > Baron wrote: > >> you should know, that I have > >> contacted many publishers and I have been unable to find a publisher > >> that would allow me to publish the book and also allow me to release > >> it for free. > > > Massimo I'm confused. You say you were trying to find a publisher that > > would allow you to give away the soft copy (I assume then that > > arrangement still satisfies your academic requirements). But when I > > suggested that same arrangement you got quite defensive... > > > Did you approach Apress? The online Django book was published by > > Apress. > > > Baron > > > On Apr 6, 3:22 pm, mdipierro wrote: > >> First of all this question pops up almost weekly and I have responded > >> many times. Anyway, I am going to respond once more, but please first > >> ask yourself: > > >> How do you earn your leaving? Why don't you work for free? > > >> I do not make money from the book (just enough to pay for web2py > >> expenses, like the web2py pycon hats) but I make money as a professor > >> (in order to pay my mortgage and feed my family). In my job I get > >> evaluated yearly for my publications not for the open source code I > >> write. The printed book counts as a publication and partially accounts > >> for the time I spend on web2py. Moreover a printed book gives web2py > >> a certain weight among professionals (who understands that not > >> everything comes for free). Finally, you should know, that I have > >> contacted many publishers and I have been unable to find a publisher > >> that would allow me to publish the book and also allow me to release > >> it for free. This is not a book written by the community and there are > >> books on Django, Rails, TG, etc, that do not have a free online > >> version. The creators of Django make money from software development > >> and consulting. For them the book is publicity. > > >> I find very odd that you ask me to justify why not everything I do is > >> free. I guess I could change the business model, give the book for > >> free, quit my job and charge you to answer your questions about > >> web2py. > > >> Massimo > > >> On Apr 5, 6:54 pm, Baron wrote: > > Massimo you should place some really deep and exact explanation about > >>> the book status and reasons why it is not free to the website..:) > >>> agreed - why does Massimo never weigh in on these threads? --~--~-~--~~~---~--~~ 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:19432] Little Bug Report on Auth API - (Register function) Tools.py
Hello mate, We are able to register a user with empty password when using Auth API for registration. So basically if you have a controller like this : # controller (with "auth" already define in model) def register(): return dict(registerform = auth.register(next="blabla")) # A view {{=registerform}} You will see a form which include two fields for the password. If you enter different value for the password then you normally receive an error message "Mismatched password" which is OK. BUT if you enter empty values in the both fields the registration is SUCCESSFUL and I don't think we want that... So basically inside Tools.py file in class "Auth" the validation process inside the method "Register" we have to add IS_NOT_EMPTY() Here is how it is right now: # def register(): td.append(INPUT(_name="password2", _type="password", requires= [IS_EXPR('value==%s' % repr(request.vars.get (password,None)),error_message=self.messages.mismatched_password)])) ## Here is how it should be to fix this little problem: ## def register(): . td.append(INPUT(_name="password2", _type="password", requires=[IS_EXPR('value==%s' % repr (request.vars.get (password,None)),error_message=self.messages.mismatched_password), IS_NOT_EMPTY()])) ## I'm currently using Web2py Version 1.59 Thanks for your attention ! Cheers, Yannick P. --~--~-~--~~~---~--~~ 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:19433] How to use tags {{}} in javascript
Hi, I tried to use {{=xxx}} in javascript tags but it did not work. e.g. if ( {{=xxx}}=='True'){ } What do I do? Thanks --~--~-~--~~~---~--~~ 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:19434] Re: The official Web2py Book by Massimo....for free?
When I called one year ago they would not publish the book at all. Now we have 10 times more users so it may me worth calling them again. I will give it a try. Massimo On Apr 7, 7:33 pm, Baron wrote: > > stop blaming him for that silly 'problem' you can solve for $10. > > FYI I have already bought the book. You are right that it is a trivial > amount for someone who is already convinced of the benefits of > web2py. > However it is an obstacle for beginners who are evaluating web2py > while the free documentation is not ready. > Also the book is getting out of date. > > Massimo said selling the book is not motivated by profit and he was > looking for a way to simultaneously give it away anyway, just he > couldn't find the right publisher. > Apress permitted this arrangement for the Django Project so it should > be possible for web2py too. > > Baron > > On Apr 7, 11:18 am, Michal Jursa wrote: > > > HEY PEOPLE! > > Stop blaming Massimo for nonfree book! > > > He wrote the book, he is owner of all rights, copyrights etc. and it is > > absolutely on him if he will or will not let it go for free. He > > explained so many times it is not his job to sell the book but he has > > some reasons to do that and it is not only on him. Accept it or not, but > > let Massimo live and breath. He is doing GREAT job, spends a lot of time > > with you all, working on web2py, answering questions, fixing bugs etc > > etc. So stop blaming him for that silly 'problem' you can solve for $10. > > If you are really seriously interested in web2py then this is not price > > to stop you. I bought the book and i'm absolutely happy with it and i > > know i'm not alone. > > > Michal alias Plysak > > > Baron wrote: > > >> you should know, that I have > > >> contacted many publishers and I have been unable to find a publisher > > >> that would allow me to publish the book and also allow me to release > > >> it for free. > > > > Massimo I'm confused. You say you were trying to find a publisher that > > > would allow you to give away the soft copy (I assume then that > > > arrangement still satisfies your academic requirements). But when I > > > suggested that same arrangement you got quite defensive... > > > > Did you approach Apress? The online Django book was published by > > > Apress. > > > > Baron > > > > On Apr 6, 3:22 pm, mdipierro wrote: > > >> First of all this question pops up almost weekly and I have responded > > >> many times. Anyway, I am going to respond once more, but please first > > >> ask yourself: > > > >> How do you earn your leaving? Why don't you work for free? > > > >> I do not make money from the book (just enough to pay for web2py > > >> expenses, like the web2py pycon hats) but I make money as a professor > > >> (in order to pay my mortgage and feed my family). In my job I get > > >> evaluated yearly for my publications not for the open source code I > > >> write. The printed book counts as a publication and partially accounts > > >> for the time I spend on web2py. Moreover a printed book gives web2py > > >> a certain weight among professionals (who understands that not > > >> everything comes for free). Finally, you should know, that I have > > >> contacted many publishers and I have been unable to find a publisher > > >> that would allow me to publish the book and also allow me to release > > >> it for free. This is not a book written by the community and there are > > >> books on Django, Rails, TG, etc, that do not have a free online > > >> version. The creators of Django make money from software development > > >> and consulting. For them the book is publicity. > > > >> I find very odd that you ask me to justify why not everything I do is > > >> free. I guess I could change the business model, give the book for > > >> free, quit my job and charge you to answer your questions about > > >> web2py. > > > >> Massimo > > > >> On Apr 5, 6:54 pm, Baron wrote: > > > Massimo you should place some really deep and exact explanation about > > >>> the book status and reasons why it is not free to the website..:) > > >>> agreed - why does Massimo never weigh in on these threads? --~--~-~--~~~---~--~~ 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:19435] Re: How to use tags {{}} in javascript
Assuming the JS is in a view (not a .js file) if ( {{=xxx}}=='True'){ should work but probably does not do what you want. My guess is that you want if ( "{{=xxx}}"=='True'){ or {{import gluon.contrib.simplejson as sj}} if ( {{=js.dumps(xxx)}}==true){ check the source if the generated output from the browser. Massimo On Apr 7, 9:11 pm, Monty808 wrote: > Hi, > > I tried to use {{=xxx}} in javascript tags but it did not work. e.g. > > if ( {{=xxx}}=='True'){ > > } > > What do I do? > > Thanks --~--~-~--~~~---~--~~ 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:19436] Table already exists, yes I know so SKIP it.
OperationalError: (1050, "Table 'users' already exists") I know it already exists, but I want you to just know about it rather than try to create it all the time. I tried clearing out my /databases folder as well. Any other ideas? --~--~-~--~~~---~--~~ 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:19437] Re: Table already exists, yes I know so SKIP it.
If the table already exists db.define_table(, migrate=False) Massimo On Apr 7, 11:18 pm, TheDude wrote: > OperationalError: (1050, "Table 'users' already exists") > > I know it already exists, but I want you to just know about it rather > than try to create it all the time. I tried clearing out my /databases > folder as well. Any other ideas? --~--~-~--~~~---~--~~ 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:19438] Re: not unicode
Denes, > same here, IS_LENGTH is invalid with integers (numbers don't have a > length property in Python). I didn't know that, however, removing the IS_LENGTH() validator solved the problem )after finishing the first version of the application I am working on I'll definitely have to dive into Python). For the record: > (an example of copy/paste/forget-to-fix, it happens to me too) Thanks, but even so a stupid mistake. > I don't know how postal codes look like over there but Massimo's > suggestion only works if they are exactly 4 digits long and if they > are strings, otherwise you will get the same "Not Unicode" error. Over here postal codes read like: 1012 DV or 9903 AV and they never start with a 0; --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---