[web2py] Question about routes
I use web2py with GAE. This is a snippet of my index.html {{ =response.title }} When I don't use a routes.py I have got a page but without pics and css marking. My URL in this case is localhost:8080/lyc/default/index/ news. I try use the routes.py with next instructions routes_in = ( (r'/(?Pnews|speciality)', r'/lyc/default/index/ \g'), (r'/(?Phistory|contacts|credits)', r'/lyc/default/ show/\g'),) routes_out = ( (r'/lyc/default/index/\g', r'/(?Pnews| speciality)'), (r'/lyc/default/show/\g', r'/(?Phistory|contacts| credits)'),) My URL in this case is localhost:8080/news. All pics shown and css applied. I've little modified my routes.py to the next view routes_in = ( (r'/(?Pnews|speciality)', r'/lyc/default/index/ \g'), (r'/(?Phistory|contacts|credits)', r'/lyc/default/ show/\g'), (r'/(?Pnews|speciality)/(?P\d+)', r'/lyc/default/ show/\g/\g'),) routes_out = ( (r'/lyc/default/index/\g', r'/(?Pnews| speciality)'), (r'/lyc/default/show/\g', r'/(?Phistory|contacts| credits)'), (r'/lyc/default/show/\g/\g', r'/(?Pnews| speciality)/(?P\d+))'),) When my URL is localhost:8080/news or localhost:8080/credits etc. all OK, but when URL is localhost:8080/news/97 for example I've got expected page without any pics and css.
Re: [web2py] Re: Best method for creating sortable lists that are css theme-able, ajax updateable, and pagination??
Powertables https://bitbucket.org/rochacbruno/powertable/overview If you only want to print fancy a very basic table https://bitbucket.org/mulonemartin/plugin_simpletable/wiki/Home 2011/2/26 pbreit > DataTables is probably a good option since Bruno has done a lot of work > getting it into Web2py. In a previous life, we used YUI DataTables which > were really nice: http://developer.yahoo.com/yui/datatable/ They aren't > as fancy as some of the Jquery options but usually fit in much better with > your own web site. -- Pablo Martín Mulone (mar...@tecnodoc.com.ar) http://www.tecnodoc.com.ar/ Paraná, Entre Ríos, Argentina (CP 3100). My blog: http://martin.tecnodoc.com.ar Expert4Solution Profile: http://www.experts4solutions.com/e4s/default/expert/6
[web2py] extract_mysql_models.py
how would I use extract_mysql_models.py to extract a existing mysql database
Re: [web2py] extract_mysql_models.py
This plugin needs: mysql mysqldump installed and globally available. usage extract_mysql_models.py username:password@data_basename
[web2py] New Web2Py Webhoster
Budgetbytes Hosting Solutions now offers Web2Py support. The website is still in Dutch, but will be released in english around march. For only € 1,50 per month (inc BTW/V.A.T) you get 500MB webspace. Technical support will be offered by Budgetbytes, but no Functional Support. Python version 2.6.4 Web2Py version 1.92.1 - Admin console enabled through https. https://www.budgetbytes.nl (if you want to order click "bestellen")
[web2py] Re: newb - a postgres database view
> Hi All- making some progress here in week 1 with web2py... > I wrote my postgres database first, and generated the model from it.. > and that is working well .. 1) build your models in Web2py and let it create your DB schema > But I have one *postgres* view, which is about 5 joins.. I dont yet > understand.. > Do i have to write this out in the web2py *QL, or can I execute sql > and return it somehow .. 2) try to first use Web2py DAL. Maybe his answer was not what you expected but it is surely related and correct. > (I do not yet understand how I specify response._vars and such for > web2py views... > - will re-read while researcing ) > the ideal interface would be something like : > choose a concat of date + company from a popup at the top.. > or, heck, just the pkey for now > get a collection of 250 formatted rows in a scrolling window below, > per popup choice > The rows are filled in by 3 joins from a central table to 3 fk_tables > The popup choice fills in company info in the header.. I suggest posting the table details so that anyone willing to help can reply with web2py specific code samples. > thanks in advance for leads on this.. > -Brian
[web2py] Re: The two halves of cache management - what's the recommended method of flushing?
a thought... would anyone recommend that one avoids passing a cache parameter into .select() and instead handle the cache keys oneself? that would enable smarter clearing of cache keys when the database is updated and so rely on less internal Web2py detail On Feb 25, 5:18 pm, Carl wrote: > Web2py has an elegant interface to using cache (ram/disk/memcache) but > is there a hole when it is applied to database actions? > > When using database .select() statements one can specify the use of > caching using... > e.g., ... .select(cache=(cache.ram, 60 * 60 * 24)) # cache result for > a day > > To flush a cache I can't find a clean/targeted solution. > > I've read postings (mdipierro, 9mar2010): > ... after insert/update/delete you do > db(...).select(cache=(cache.disk,0)) > > or: > cache.ram.clear(db._uri + '/SELECT') > > The former flushes all the contents of the cache and the latter, using > the private variable _uri, restricts the flush to all database > selects. > > Is there a better way extend Web2py's cache system to supporting > databases? > > Can we get one more step of specificity? Namely, can we limit the > flush to a specific table or tables?
Re: [web2py] extract_mysql_models.py
Why am I getting this error when using the "extract_mysql_models.py" script? Given below is the traceback. C:\Documents and Settings\rupeshpradhan\Desktop\scripts>python extract_mysql_models.py rupesh:password@rockvale Traceback (most recent call last): File "extract_mysql_models.py", line 106, in print mysql(m.group(3),m.group(1),m.group(2)) File "extract_mysql_models.py", line 62, in mysql stderr=subprocess.PIPE) File "D:\Python25\lib\subprocess.py", line 594, in __init__ errread, errwrite) File "D:\Python25\lib\subprocess.py", line 822, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified
[web2py] Re: New Web2Py Webhoster
+1 On Feb 26, 6:17 am, Budgetbytes wrote: > Budgetbytes Hosting Solutions now offers Web2Py support. The website > is still in Dutch, but will be released in english around march. > > For only € 1,50 per month (inc BTW/V.A.T) you get 500MB webspace. > Technical support will be offered by Budgetbytes, but no Functional > Support. > > Python version 2.6.4 > Web2Py version 1.92.1 - Admin console enabled through https. > > https://www.budgetbytes.nl > (if you want to order click "bestellen")
[web2py] Extracting data from a list having data in the format of a key, data
Method I c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] key=3 >>> for i, j in c: ... if i==key: print j UKG Method II - c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] r = dict((x[0],x[1]) for x in c) print r[3] UKG Method III -- Anything better than the above two?
Re: [web2py] extract_mysql_models.py
please read the comments from the script Under Windows you will probably need to add the mysql executable directory > to the PATH variable, > you will also need to modify mysql to mysql.exe and mysqldump to > mysqldump.exe below. > Just guessing here :)
Re: [web2py] Question about routes
On Feb 26, 2011, at 3:29 AM, walter wrote: > > When my URL is localhost:8080/news or localhost:8080/credits etc. all > OK, but when URL is localhost:8080/news/97 for example I've got > expected page without any pics and css. You might try making your css references absolute paths. Instead of use Also, it looks like you've got your ?P and \g reversed in routes_out.
Re: [web2py] New Web2Py Webhoster
This is great. Very affordable.500Mb is enough for most of users. Added into bookmarks :) On Sat, Feb 26, 2011 at 1:17 PM, Budgetbytes wrote: > Budgetbytes Hosting Solutions now offers Web2Py support. The website > is still in Dutch, but will be released in english around march. > > For only € 1,50 per month (inc BTW/V.A.T) you get 500MB webspace. > Technical support will be offered by Budgetbytes, but no Functional > Support. > > Python version 2.6.4 > Web2Py version 1.92.1 - Admin console enabled through https. > > https://www.budgetbytes.nl > (if you want to order click "bestellen") >
[web2py] Small bug in gluon/widget.py and something more
Hello, I'm finishing the Debian packages for web2py (I hope to finish them this weekend), and as the tk graphic interface in widget.py is really ugly on a linux machine, I've done a gtk clone of this same interface. Doing it , I've seen a bug in line 411 of http://code.google.com/p/web2py/source/browse/gluon/widget.py : t1 = os.path.size('httpserver.log') should be: t1 = os.path.getsize('httpserver.log') On the other hand, Massimo, would you be interested in adding the gtk web2py server interface to web2py? If not I'd just add it as a patch to the Debian packages. Regards José L.
[web2py] Re: The two halves of cache management - what's the recommended method of flushing?
I cannot think of a better way but, if you use cache.ram, you can find the actual cached data in cache.ram.meta_storage[request.application] which is a python dict. It if not thread safe to write in there unless you do: cache.ram.locker.lock() cache.ram.meta_storage[request.application][key]=value cache.ram.locker.release() You can try find out what is in there and clear it yourself. On Feb 26, 7:59 am, Carl wrote: > a thought... > > would anyone recommend that one avoids passing a cache parameter > into .select() and instead handle the cache keys oneself? > that would enable smarter clearing of cache keys when the database is > updated and so rely on less internal Web2py detail > > On Feb 25, 5:18 pm, Carl wrote: > > > > > > > > > Web2py has an elegant interface to using cache (ram/disk/memcache) but > > is there a hole when it is applied to database actions? > > > When using database .select() statements one can specify the use of > > caching using... > > e.g., ... .select(cache=(cache.ram, 60 * 60 * 24)) # cache result for > > a day > > > To flush a cache I can't find a clean/targeted solution. > > > I've read postings (mdipierro, 9mar2010): > > ... after insert/update/delete you do > > db(...).select(cache=(cache.disk,0)) > > > or: > > cache.ram.clear(db._uri + '/SELECT') > > > The former flushes all the contents of the cache and the latter, using > > the private variable _uri, restricts the flush to all database > > selects. > > > Is there a better way extend Web2py's cache system to supporting > > databases? > > > Can we get one more step of specificity? Namely, can we limit the > > flush to a specific table or tables?
[web2py] Re: Extracting data from a list having data in the format of a key, data
c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] r = dict(c) print r[3] or print [x[1] for x in c if x[0]==3][0] On Feb 26, 9:04 am, Rupesh Pradhan wrote: > Method I > > c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] > key=3 > > >>> for i, j in c: > > ... if i==key: print j > > UKG > > Method II > - > c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] > r = dict((x[0],x[1]) for x in c) > > print r[3] > > UKG > > Method III > -- > Anything better than the above two?
[web2py] Re: Extracting data from a list having data in the format of a key, data
On Feb 26, 10:04 am, Rupesh Pradhan wrote: > Method I > > c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] > key=3 > > >>> for i, j in c: > > ... if i==key: print j > > UKG > > Method II > - > c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] > r = dict((x[0],x[1]) for x in c) r = dict(c) is enough > > print r[3] > > UKG > > Method III > -- > Anything better than the above two?
Re: [web2py] Re: The two halves of cache management - what's the recommended method of flushing?
thanks Massimo. I'm using memcache on dev_appserver & GAE and just cache.ram locally; so I think "wrapping" database access and managing cache keys myself are probably the best route forward. On 26 February 2011 16:31, Massimo Di Pierro wrote: > I cannot think of a better way but, if you use cache.ram, you can find > the actual cached data in > > cache.ram.meta_storage[request.application] > > which is a python dict. It if not thread safe to write in there unless > you do: > > > cache.ram.locker.lock() > cache.ram.meta_storage[request.application][key]=value > cache.ram.locker.release() > > You can try find out what is in there and clear it yourself. > > > On Feb 26, 7:59 am, Carl wrote: > > a thought... > > > > would anyone recommend that one avoids passing a cache parameter > > into .select() and instead handle the cache keys oneself? > > that would enable smarter clearing of cache keys when the database is > > updated and so rely on less internal Web2py detail > > > > On Feb 25, 5:18 pm, Carl wrote: > > > > > > > > > > > > > > > > > Web2py has an elegant interface to using cache (ram/disk/memcache) but > > > is there a hole when it is applied to database actions? > > > > > When using database .select() statements one can specify the use of > > > caching using... > > > e.g., ... .select(cache=(cache.ram, 60 * 60 * 24)) # cache result for > > > a day > > > > > To flush a cache I can't find a clean/targeted solution. > > > > > I've read postings (mdipierro, 9mar2010): > > > ... after insert/update/delete you do > > > db(...).select(cache=(cache.disk,0)) > > > > > or: > > > cache.ram.clear(db._uri + '/SELECT') > > > > > The former flushes all the contents of the cache and the latter, using > > > the private variable _uri, restricts the flush to all database > > > selects. > > > > > Is there a better way extend Web2py's cache system to supporting > > > databases? > > > > > Can we get one more step of specificity? Namely, can we limit the > > > flush to a specific table or tables? >
[web2py] Re: Small bug in gluon/widget.py and something more
Thanks, your fix is in trunk. I'd like to see the gtk version and I am ok to you adding it to trunk but Ido not think we should add a new dependence. Massimo On Feb 26, 10:13 am, José L. wrote: > Hello, > I'm finishing the Debian packages for web2py (I hope to finish them this > weekend), and as the tk graphic interface in widget.py is really ugly on a > linux machine, I've done a gtk clone of this same interface. > Doing it , I've seen a bug in line 411 > ofhttp://code.google.com/p/web2py/source/browse/gluon/widget.py: > t1 = os.path.size('httpserver.log') > should be: > t1 = os.path.getsize('httpserver.log') > > On the other hand, Massimo, would you be interested in adding the gtk web2py > server interface to web2py? If not I'd just add it as a patch to the Debian > packages. > > Regards > > José L.
[web2py] bug with type
if type('asd') == str: pass Traceback (most recent call last): File "/home/www-data/web2py/gluon/restricted.py", line 188, in restricted exec ccode in environment File "/home/www-data/web2py/applications/rushops/controllers/ shop.py", line 376, in File "/home/www-data/web2py/gluon/globals.py", line 95, in self._caller = lambda f: f() File "/home/www-data/web2py/gluon/tools.py", line 2314, in f return action(*a, **b) File "/home/www-data/web2py/applications/rushops/controllers/ shop.py", line 203, in structure if type('asd') == str: UnboundLocalError: local variable 'type' referenced before assignment but in the other function: ids = request.vars.filetodelete if type(ids) != list and ids: ids = [ids] works fine
[web2py] Re: bug with type
So I make little function, that's work def makelist(items): if type(items) != list: items = [items] return items but don't understand, why previous not working On 26 фев, 23:53, LightOfMooN wrote: > if type('asd') == str: > pass > > Traceback (most recent call last): > File "/home/www-data/web2py/gluon/restricted.py", line 188, in > restricted > exec ccode in environment > File "/home/www-data/web2py/applications/rushops/controllers/ > shop.py", line 376, in > File "/home/www-data/web2py/gluon/globals.py", line 95, in > self._caller = lambda f: f() > File "/home/www-data/web2py/gluon/tools.py", line 2314, in f > return action(*a, **b) > File "/home/www-data/web2py/applications/rushops/controllers/ > shop.py", line 203, in structure > if type('asd') == str: > UnboundLocalError: local variable 'type' referenced before assignment > > but in the other function: > > ids = request.vars.filetodelete > if type(ids) != list and ids: > ids = [ids] > > works fine
[web2py] plugin_wiki printing code
Hi All, I'm testing the widget of the plugin_wiki in a view. I added {{=plugin_wiki.widget('map',key='yrtable',table='auth_user',width=400, height=200)}} after installing the plugin but instead of getting a map I'm getting the JS code printed in the page ! If I see the page generated code, I can see: etc... any ideas ? thanks -- Sebastian E. Ovide
Re: [web2py] bug with type
On Feb 26, 2011, at 10:53 AM, LightOfMooN wrote: > > if type('asd') == str: >pass Could you post the whole function? It sounds like you might be rebinding type. > > Traceback (most recent call last): > File "/home/www-data/web2py/gluon/restricted.py", line 188, in > restricted >exec ccode in environment > File "/home/www-data/web2py/applications/rushops/controllers/ > shop.py", line 376, in > File "/home/www-data/web2py/gluon/globals.py", line 95, in >self._caller = lambda f: f() > File "/home/www-data/web2py/gluon/tools.py", line 2314, in f >return action(*a, **b) > File "/home/www-data/web2py/applications/rushops/controllers/ > shop.py", line 203, in structure >if type('asd') == str: > UnboundLocalError: local variable 'type' referenced before assignment > > > but in the other function: > > ids = request.vars.filetodelete >if type(ids) != list and ids: >ids = [ids] > > works fine
[web2py] Re: bug with type
It does not work in a function that later defines type as a local variable, that overrides the type() function. On Feb 26, 1:02 pm, LightOfMooN wrote: > So I make little function, that's work > > def makelist(items): > if type(items) != list: > items = [items] > return items > > but don't understand, why previous not working > > On 26 фев, 23:53, LightOfMooN wrote: > > > > > > > > > if type('asd') == str: > > pass > > > Traceback (most recent call last): > > File "/home/www-data/web2py/gluon/restricted.py", line 188, in > > restricted > > exec ccode in environment > > File "/home/www-data/web2py/applications/rushops/controllers/ > > shop.py", line 376, in > > File "/home/www-data/web2py/gluon/globals.py", line 95, in > > self._caller = lambda f: f() > > File "/home/www-data/web2py/gluon/tools.py", line 2314, in f > > return action(*a, **b) > > File "/home/www-data/web2py/applications/rushops/controllers/ > > shop.py", line 203, in structure > > if type('asd') == str: > > UnboundLocalError: local variable 'type' referenced before assignment > > > but in the other function: > > > ids = request.vars.filetodelete > > if type(ids) != list and ids: > > ids = [ids] > > > works fine
[web2py] Re: plugin_wiki printing code
actually it happens only with "map"... (it doesn't happen with youtube) On Sat, Feb 26, 2011 at 7:10 PM, Sebastian E. Ovide < sebastian.ov...@gmail.com> wrote: > Hi All, > > I'm testing the widget of the plugin_wiki in a view. > > I added > {{=plugin_wiki.widget('map',key='yrtable',table='auth_user',width=400, > height=200)}} after installing the plugin but instead of getting a map I'm > getting the JS code printed in the page ! > > If I see the page generated code, I can see: > > > > etc... > > any ideas ? > > thanks > -- > Sebastian E. Ovide > > > > -- Sebastian E. Ovide
[web2py] Re: Small bug in gluon/widget.py and something more
On Saturday, February 26, 2011 7:29:09 PM UTC+1, Massimo Di Pierro wrote: > > Thanks, > your fix is in trunk. > > I'd like to see the gtk version and I am ok to you adding it to trunk > but Ido not think we should add a new dependence. > > I've uploaded the module widget.py and its diff with current stable version (1.92.1) to it to http://people.debian.org/~jredrejo/web2py/ In fact, it doesn't add a new dependency: if you have gtk installed it will run, otherwise it will try it with Tkinter or console if tk is not available either. Most linux desktops have gtk available so, the look is much better. For the Debian package I'm adding python-gtk2 | python-tk as recommended packages, not dependencies. It's almost finished, only the update_canvas method is still in work. Also, I don't see the purpose of the update(self, text) method in web2pyDialog, so I haven't translated it into the gtk class. Tell me if it's needed. Regards. José L. > Massimo > > >
[web2py] Re: Displaying br instead new line in views
guys, if you have the same trouble I just did, this should work. Try it: {{=XML(note.content.replace('\\n',''),sanitize=True)}} Best regards On Feb 20, 9:35 pm, DenesL wrote: > {{=XML(note.content.replace('\n',''),sanitize=True)}} > > On Feb 20, 12:10 pm, Alexandre Strzelewicz > > > > wrote: > > Same :/ I've already tried to replace double quotes with nothing > > > On Feb 20, 5:34 pm, Jonathan Lundell wrote: > > > > On Feb 20, 2011, at 8:13 AM, Alexandre Strzelewicz wrote: > > > > > Rhm sorry for posting 4 times the same message... > > > > > {{=XML(note.content, sanitize=True).xml().replace('\n','')}} > > > > > replace '\n' with 'br' but web2py quote the content : > > > > > "* Test1 > > > > * Test2 > > > > * Test3 > > > > " > > > > > and without replacing '\n' with 'br' it doesn't insert double quotes. > > > > > * Test1 > > > > * Test2 > > > > * Test3 > > > > > But without br there are no new line. > > > > > It seems to be so simple but I've no passtrough to avoid this problem. > > > > Perhaps: > > > > {{=XML(note.content, sanitize=True).xml().replace('\n',' > > />').strip(")}} > > > > > On Feb 20, 1:06 am, Bruno Rocha wrote: > > > >> I guess it should be 'sanitize' > > > > >> {{=XML(note.content, sanitize=True).xml().replace('\n',')}} > > > > >> Bruno Rocha > > > >> [ About me:http://zerp.ly/rochacbruno] > > > > >> 2011/2/19 Alexandre Strzelewicz > > > > >>> Thanks, but it doesn't work, it gives me the error "unexpected keyword > > > >>> argument escape". > > > > >>> Is there a way to remove double quotes when printing > > > >>> {{=note.content}} ? > > > > >>> On Sat, Feb 19, 2011 at 4:03 PM, Massimo Di Pierro < > > > >>> massimo.dipie...@gmail.com> wrote: > > > > try this: > > > > {{=XML(note.content,escape=True).xml().replace('\n',')}} > > > > On Feb 19, 8:18 am, Alexandre Strzelewicz > > > wrote: > > > > In my view I display text with : > > > > {{=note.content}} > > > > > But I didnt find a way to replace new line with . > > > > I tried directly with replace('\n', '') but it escapes the br > > > > in > > > > html format > > > > > Thanks > > > > >>> -- > > > >>> Cordialement, > > > >>> Alexandre Strzelewicz > > > > >>>www.hemca.com
[web2py] Re: bug with type
function is too big (150+strings) but I find some peace of code in it: props = get_props_by_section_id_list([section_id,]) gsp_ids = {} for type in props.keys(): gsp_ids[type] = {} for prop in props[type]: gsp_ids[type] [prop.id]=db((prop.id==db.sections_properties.prop_id)&(db.sections_properties.type==type)).select(db.sections_properties.id).first().id maybe because of that? On 27 фев, 00:11, Jonathan Lundell wrote: > On Feb 26, 2011, at 10:53 AM, LightOfMooN wrote: > > > > > if type('asd') == str: > > pass > > Could you post the whole function? It sounds like you might be rebinding type. > > > > > > > > > > > Traceback (most recent call last): > > File "/home/www-data/web2py/gluon/restricted.py", line 188, in > > restricted > > exec ccode in environment > > File "/home/www-data/web2py/applications/rushops/controllers/ > > shop.py", line 376, in > > File "/home/www-data/web2py/gluon/globals.py", line 95, in > > self._caller = lambda f: f() > > File "/home/www-data/web2py/gluon/tools.py", line 2314, in f > > return action(*a, **b) > > File "/home/www-data/web2py/applications/rushops/controllers/ > > shop.py", line 203, in structure > > if type('asd') == str: > > UnboundLocalError: local variable 'type' referenced before assignment > > > but in the other function: > > > ids = request.vars.filetodelete > > if type(ids) != list and ids: > > ids = [ids] > > > works fine
Re: [web2py] Re: bug with type
On Feb 26, 2011, at 11:50 AM, LightOfMooN wrote: > > function is too big (150+strings) > but I find some peace of code in it: > > props = get_props_by_section_id_list([section_id,]) >gsp_ids = {} >for type in props.keys(): >gsp_ids[type] = {} >for prop in props[type]: >gsp_ids[type] > [prop.id]=db((prop.id==db.sections_properties.prop_id)&(db.sections_properties.type==type)).select(db.sections_properties.id).first().id > > maybe because of that? Yes. That creates a local binding of type that obscures the built-in function. Change 'type' here to another name and you should be OK. > > On 27 фев, 00:11, Jonathan Lundell wrote: >> On Feb 26, 2011, at 10:53 AM, LightOfMooN wrote: >> >> >> >>> if type('asd') == str: >>>pass >> >> Could you post the whole function? It sounds like you might be rebinding >> type. >> >> >> >> >> >> >> >> >> >>> Traceback (most recent call last): >>> File "/home/www-data/web2py/gluon/restricted.py", line 188, in >>> restricted >>>exec ccode in environment >>> File "/home/www-data/web2py/applications/rushops/controllers/ >>> shop.py", line 376, in >>> File "/home/www-data/web2py/gluon/globals.py", line 95, in >>>self._caller = lambda f: f() >>> File "/home/www-data/web2py/gluon/tools.py", line 2314, in f >>>return action(*a, **b) >>> File "/home/www-data/web2py/applications/rushops/controllers/ >>> shop.py", line 203, in structure >>>if type('asd') == str: >>> UnboundLocalError: local variable 'type' referenced before assignment >> >>> but in the other function: >> >>> ids = request.vars.filetodelete >>>if type(ids) != list and ids: >>>ids = [ids] >> >>> works fine
[web2py] Re: bug with type
Yes, it's so. I should be more careful with variable names :) On 27 фев, 00:54, Jonathan Lundell wrote: > On Feb 26, 2011, at 11:50 AM, LightOfMooN wrote: > > > > > function is too big (150+strings) > > but I find some peace of code in it: > > > props = get_props_by_section_id_list([section_id,]) > > gsp_ids = {} > > for type in props.keys(): > > gsp_ids[type] = {} > > for prop in props[type]: > > gsp_ids[type] > > [prop.id]=db((prop.id==db.sections_properties.prop_id)&(db.sections_propert > > ies.type==type)).select(db.sections_properties.id).first().id > > > maybe because of that? > > Yes. That creates a local binding of type that obscures the built-in > function. Change 'type' here to another name and you should be OK. > > > > > > > > > > > On 27 фев, 00:11, Jonathan Lundell wrote: > >> On Feb 26, 2011, at 10:53 AM, LightOfMooN wrote: > > >>> if type('asd') == str: > >>> pass > > >> Could you post the whole function? It sounds like you might be rebinding > >> type. > > >>> Traceback (most recent call last): > >>> File "/home/www-data/web2py/gluon/restricted.py", line 188, in > >>> restricted > >>> exec ccode in environment > >>> File "/home/www-data/web2py/applications/rushops/controllers/ > >>> shop.py", line 376, in > >>> File "/home/www-data/web2py/gluon/globals.py", line 95, in > >>> self._caller = lambda f: f() > >>> File "/home/www-data/web2py/gluon/tools.py", line 2314, in f > >>> return action(*a, **b) > >>> File "/home/www-data/web2py/applications/rushops/controllers/ > >>> shop.py", line 203, in structure > >>> if type('asd') == str: > >>> UnboundLocalError: local variable 'type' referenced before assignment > > >>> but in the other function: > > >>> ids = request.vars.filetodelete > >>> if type(ids) != list and ids: > >>> ids = [ids] > > >>> works fine
[web2py] Re: Multiple Column Unique Fields
Hey Ross, Had this same problem and found this: http://stackoverflow.com/questions/2671913/sql-how-can-i-apply-a-semi-unique-constraint Chris On Feb 19, 6:07 pm, Ross Peoples wrote: > Ok, removing unique=True and using the line that Massimo gave me seems to do > the trick. The validation is only at form level, but that should be good > enough for my needs. > > Thanks guys.
[web2py] what's the average learning curve?
for a basic shopping recommendation site, can a single newbie make a reasonably good one in 3 month (starting from scratch)? Any suggestion?
[web2py] Python fourth on the list
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html -- Ovidio Marinho Falcao Neto ovidio...@gmail.com Tecnologia da Informaçao Casa Civil do Governador 83 3214 7885 - 88269088 Paraiba
[web2py] Re: what's the average learning curve?
Much depends on your starting point. If you have already accomplished some web apps, then 3 months should do the server side OK, but then how sophisticated will the client-side be? If you really are a newbie to web development, there are probably too many skills to learn in 3 months - but then I'm a slow learner. Also maybe you are working for a vague client who has just given you a sketch on an envelope, in which case it might take 3 months to agree a spec! :) On Feb 26, 9:46 pm, Sean wrote: > for a basic shopping recommendation site, can a single newbie make a > reasonably good one in 3 month (starting from scratch)? > > Any suggestion?
[web2py] Re: newb - a postgres database view
hi- thanks for this continuing thread.. I thought about it a bit, and yes, I see there is a great fundamental divide between people new to web2py jumping in and trying to make things work with executesql() and such, and on the other hand using the framework to do what it does.. that's true for me, certainly. So the answer that seemed like a non-answer to me was actually addressing a fundamental, although in paucity of expression, rather than the details at hand. I am about to sit down to write the view.. more later.. -Brian On Feb 26, 5:39 am, DenesL wrote: > > Hi All- making some progress here in week 1 with web2py... > > I wrote my postgres database first, and generated the model from it.. > > and that is working well .. > > 1) build your models in Web2py and let it create your DB schema > > > But I have one *postgres* view, which is about 5 joins.. I dont yet > > understand.. > > Do i have to write this out in the web2py *QL, or can I execute sql > > and return it somehow .. > > 2) try to first use Web2py DAL. > > Maybe his answer was not what you expected but it is surely related > and correct. > > > (I do not yet understand how I specify response._vars and such for > > web2py views... > > - will re-read while researcing ) > > the ideal interface would be something like : > > choose a concat of date + company from a popup at the top.. > > or, heck, just the pkey for now > > get a collection of 250 formatted rows in a scrolling window below, > > per popup choice > > The rows are filled in by 3 joins from a central table to 3 fk_tables > > The popup choice fills in company info in the header.. > > I suggest posting the table details so that anyone willing to help can > reply with web2py specific code samples. > > > thanks in advance for leads on this.. > > -Brian
[web2py] Re: what's the average learning curve?
"how sophisticated will the client-side be?" Are you talking about the JS, templates, css stuff? On Feb 26, 5:15 pm, villas wrote: > Much depends on your starting point. If you have already accomplished > some web apps, then 3 months should do the server side OK, but then > how sophisticated will the client-side be? If you really are a newbie > to web development, there are probably too many skills to learn in 3 > months - but then I'm a slow learner. > > Also maybe you are working for a vague client who has just given you a > sketch on an envelope, in which case it might take 3 months to agree a > spec! :) > > On Feb 26, 9:46 pm, Sean wrote: > > > > > for a basic shopping recommendation site, can a single newbie make a > > reasonably good one in 3 month (starting from scratch)? > > > Any suggestion?- Hide quoted text - > > - Show quoted text -
[web2py] Re: plugin_wiki printing code
hmmm... could be a bug. I will check this asap. I was planning to post a revised plugin_wiki tomoromow anyway. On Feb 26, 1:10 pm, "Sebastian E. Ovide" wrote: > Hi All, > > I'm testing the widget of the plugin_wiki in a view. > > I added > {{=plugin_wiki.widget('map',key='yrtable',table='auth_user',width=400, > height=200)}} after installing the plugin but instead of getting a map I'm > getting the JS code printed in the page ! > > If I see the page generated code, I can see: > > > > etc... > > any ideas ? > > thanks > -- > Sebastian E. Ovide
[web2py] Re: Small bug in gluon/widget.py and something more
a quick try with the new widget.py on Debian 6, works well for me.. On Feb 26, 11:34 am, José L. wrote: > On Saturday, February 26, 2011 7:29:09 PM UTC+1, Massimo Di Pierro wrote: > > > Thanks, > > your fix is in trunk. > > > I'd like to see the gtk version and I am ok to you adding it to trunk > > but Ido not think we should add a new dependence. > > I've uploaded the module widget.py and its diff with current stable version > (1.92.1) to it tohttp://people.debian.org/~jredrejo/web2py/ > > In fact, it doesn't add a new dependency: if you have gtk installed it will > run, otherwise it will try it with Tkinter or console if tk is not available > either. > > Most linux desktops have gtk available so, the look is much better. For the > Debian package I'm adding python-gtk2 | python-tk as recommended packages, > not dependencies. > > It's almost finished, only the update_canvas method is still in work. > > Also, I don't see the purpose of the update(self, text) method > in web2pyDialog, so I haven't translated it into the gtk class. Tell me if > it's needed. > > Regards. > José L. > > > Massimo
[web2py] Re: Small bug in gluon/widget.py and something more
OK. I only have one request. Can you define gtk_presentation in its own module in contrib and try import it from widget? I am not sure how this plays out with py2exe and py2app On Feb 26, 1:34 pm, José L. wrote: > On Saturday, February 26, 2011 7:29:09 PM UTC+1, Massimo Di Pierro wrote: > > > Thanks, > > your fix is in trunk. > > > I'd like to see the gtk version and I am ok to you adding it to trunk > > but Ido not think we should add a new dependence. > > I've uploaded the module widget.py and its diff with current stable version > (1.92.1) to it tohttp://people.debian.org/~jredrejo/web2py/ > > In fact, it doesn't add a new dependency: if you have gtk installed it will > run, otherwise it will try it with Tkinter or console if tk is not available > either. > > Most linux desktops have gtk available so, the look is much better. For the > Debian package I'm adding python-gtk2 | python-tk as recommended packages, > not dependencies. > > It's almost finished, only the update_canvas method is still in work. > > Also, I don't see the purpose of the update(self, text) method > in web2pyDialog, so I haven't translated it into the gtk class. Tell me if > it's needed. > > Regards. > José L. > > > > > > > > > Massimo
[web2py] Re: newb - a postgres database view
in case I wasnt clear, I used "extract_pgsql_models.py" to create the model.. you have to re-arrange the output, from alpha by method to leaf tables first but it appears to work well.. On Feb 26, 5:39 am, DenesL wrote: > > Hi All- making some progress here in week 1 with web2py... > > I wrote my postgres database first, and generated the model from it.. > > and that is working well .. > > 1) build your models in Web2py and let it create your DB schema > > > But I have one *postgres* view, which is about 5 joins.. I dont yet > > understand.. > > Do i have to write this out in the web2py *QL, or can I execute sql > > and return it somehow .. > > 2) try to first use Web2py DAL. > > Maybe his answer was not what you expected but it is surely related > and correct. > > > (I do not yet understand how I specify response._vars and such for > > web2py views... > > - will re-read while researcing ) > > the ideal interface would be something like : > > choose a concat of date + company from a popup at the top.. > > or, heck, just the pkey for now > > get a collection of 250 formatted rows in a scrolling window below, > > per popup choice > > The rows are filled in by 3 joins from a central table to 3 fk_tables > > The popup choice fills in company info in the header.. > > I suggest posting the table details so that anyone willing to help can > reply with web2py specific code samples. > > > thanks in advance for leads on this.. > > -Brian
[web2py] Re: Displaying br instead new line in views
Actually I think Denes is right. If you have to use '\\n' instead of '\n' something is wrong with the data you have (it is escaped twice?) Massimo On Feb 26, 1:50 pm, blackthorne wrote: > guys, > if you have the same trouble I just did, this should work. Try it: > {{=XML(note.content.replace('\\n',''),sanitize=True)}} > > Best regards > > On Feb 20, 9:35 pm, DenesL wrote: > > > > > > > > > {{=XML(note.content.replace('\n',''),sanitize=True)}} > > > On Feb 20, 12:10 pm, Alexandre Strzelewicz > > > wrote: > > > Same :/ I've already tried to replace double quotes with nothing > > > > On Feb 20, 5:34 pm, Jonathan Lundell wrote: > > > > > On Feb 20, 2011, at 8:13 AM, Alexandre Strzelewicz wrote: > > > > > > Rhm sorry for posting 4 times the same message... > > > > > > {{=XML(note.content, sanitize=True).xml().replace('\n','')}} > > > > > > replace '\n' with 'br' but web2py quote the content : > > > > > > "* Test1 > > > > > * Test2 > > > > > * Test3 > > > > > " > > > > > > and without replacing '\n' with 'br' it doesn't insert double quotes. > > > > > > * Test1 > > > > > * Test2 > > > > > * Test3 > > > > > > But without br there are no new line. > > > > > > It seems to be so simple but I've no passtrough to avoid this problem. > > > > > Perhaps: > > > > > {{=XML(note.content, sanitize=True).xml().replace('\n',' > > > />').strip(")}} > > > > > > On Feb 20, 1:06 am, Bruno Rocha wrote: > > > > >> I guess it should be 'sanitize' > > > > > >> {{=XML(note.content, sanitize=True).xml().replace('\n',')}} > > > > > >> Bruno Rocha > > > > >> [ About me:http://zerp.ly/rochacbruno] > > > > > >> 2011/2/19 Alexandre Strzelewicz > > > > > >>> Thanks, but it doesn't work, it gives me the error "unexpected > > > > >>> keyword > > > > >>> argument escape". > > > > > >>> Is there a way to remove double quotes when printing > > > > >>> {{=note.content}} ? > > > > > >>> On Sat, Feb 19, 2011 at 4:03 PM, Massimo Di Pierro < > > > > >>> massimo.dipie...@gmail.com> wrote: > > > > > try this: > > > > > {{=XML(note.content,escape=True).xml().replace('\n',')}} > > > > > On Feb 19, 8:18 am, Alexandre Strzelewicz > > > > wrote: > > > > > In my view I display text with : > > > > > {{=note.content}} > > > > > > But I didnt find a way to replace new line with . > > > > > I tried directly with replace('\n', '') but it escapes the > > > > > br in > > > > > html format > > > > > > Thanks > > > > > >>> -- > > > > >>> Cordialement, > > > > >>> Alexandre Strzelewicz > > > > > >>>www.hemca.com
[web2py] Re: bug with type
yes On Feb 26, 1:50 pm, LightOfMooN wrote: > function is too big (150+strings) > but I find some peace of code in it: > > props = get_props_by_section_id_list([section_id,]) > gsp_ids = {} > for type in props.keys(): > gsp_ids[type] = {} > for prop in props[type]: > gsp_ids[type] > [prop.id]=db((prop.id==db.sections_properties.prop_id)&(db.sections_propert > ies.type==type)).select(db.sections_properties.id).first().id > > maybe because of that? > > On 27 фев, 00:11, Jonathan Lundell wrote: > > > > > > > > > On Feb 26, 2011, at 10:53 AM, LightOfMooN wrote: > > > > if type('asd') == str: > > > pass > > > Could you post the whole function? It sounds like you might be rebinding > > type. > > > > Traceback (most recent call last): > > > File "/home/www-data/web2py/gluon/restricted.py", line 188, in > > > restricted > > > exec ccode in environment > > > File "/home/www-data/web2py/applications/rushops/controllers/ > > > shop.py", line 376, in > > > File "/home/www-data/web2py/gluon/globals.py", line 95, in > > > self._caller = lambda f: f() > > > File "/home/www-data/web2py/gluon/tools.py", line 2314, in f > > > return action(*a, **b) > > > File "/home/www-data/web2py/applications/rushops/controllers/ > > > shop.py", line 203, in structure > > > if type('asd') == str: > > > UnboundLocalError: local variable 'type' referenced before assignment > > > > but in the other function: > > > > ids = request.vars.filetodelete > > > if type(ids) != list and ids: > > > ids = [ids] > > > > works fine
[web2py] powertable question about get_category_name
Hi, I was trying to learn more from the powertable example, specifically how the represent options in the field definitions work. db.define_table('products', Field('category',db.category,label=T('CategoryW'),represent=lambda c:get_category_name(c)), I deleted the get_category_name function definition to see what would happen and I was surprised to see no difference, and no error was generated. I don't understand this and I was wondering if there was any explanation?
Re: [web2py] powertable question about get_category_name
That function was used in the example just because there was a bug with represent for referenced fields, I guess that bug is fixed and this function is now useless. The case is that a SQLTable (which is the base of powerTable) was not showing format or representation, instead it was showing None or the referenced ID. I will make some tests to see if the reference bug is fixed. Em 27/02/2011, às 00:09, tomt escreveu: > Hi, > > I was trying to learn more from the powertable example, specifically > how the represent options in the field definitions work. > > db.define_table('products', > > Field('category',db.category,label=T('CategoryW'),represent=lambda > c:get_category_name(c)), > > I deleted the get_category_name function definition to see what would > happen and I was surprised to see no difference, and no error was > generated. I don't understand this and I was wondering if there was > any explanation?
[web2py] Re: what's the average learning curve?
Are you new to programming? Python? Or just new to Web2py? I had a very modest amount of prior programming experience, none of it on Python, and I was able to make very good progress on a storefront application in a matter of days and weeks. I suspect adding the final 20% of polish will take 80% of the time, though. I looked at a variety of frameworks (CodeIgniter, Rails, Django) and found Web2py to be both the easiest to lear and use and also offer the most productivity. As Villas notes, the front-end can take the most energy depending on how fancy you want to get with your HTML, JavaScript, Ajax, etc. I usually suggest keeping it simple. You can layer in complexity over time.
[web2py] sending password and username emails fail
When I click password and username recovery in my app, the app flashes "Mail Sent" but it isn't. Reviewing the mail server logs I find... Feb 27 03:45:10 admin01 sendmail[13140]: STARTTLS=server, relay=localhost [127.0.0.1], version=TLSv1/SSLv3, verify=NO, cipher=DHE-RSA-AES256-SHA, bits=256/256 Feb 27 03:45:11 admin01 sendmail[13140]: p1R3jAkU013140: localhost [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA My latest settings in db.py are: mail.settings.server = 'localhost:25' # your SMTP server mail.settings.sender = 'nore...@x.com' # your email mail.settings.login = None # your credentials or None I've also tried port 587 with a valid username and password. My mailer is configured to use all the usual authentication methods and ciphers, and answers as: 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 250-DSN 250-ETRN 250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5 250-STARTTLS 250-DELIVERBY 250 HELP I believe that once TLS starts, it will also allow PLAIN. Not sure what is going on here. Any help appreciated.
[web2py] Re: plugin_wiki printing code
This reminds me, (and I could wrong - or could have been the editor playing tricks), but now that I think if it, i noticed that some code looked strange in some parts where I remember thinking probably quote or a tic may be off... Seems that a couple of bits if code looked commented out while near by comments looked "uncommented"... but forgot to go back and look. Again, could have been just the editor or could have been reading it too fast, then again my glasses are getting thicker and thicker... I'll check and reply if anything turns up. Mart :) On Feb 26, 9:27 pm, Massimo Di Pierro wrote: > hmmm... could be a bug. I will check this asap. I was planning to post > a revised plugin_wiki tomoromow anyway. > > On Feb 26, 1:10 pm, "Sebastian E. Ovide" > wrote: > > > > > > > > > Hi All, > > > I'm testing the widget of the plugin_wiki in a view. > > > I added > > {{=plugin_wiki.widget('map',key='yrtable',table='auth_user',width=400, > > height=200)}} after installing the plugin but instead of getting a map I'm > > getting the JS code printed in the page ! > > > If I see the page generated code, I can see: > > > > > > etc... > > > any ideas ? > > > thanks > > -- > > Sebastian E. Ovide
[web2py] Re: plugin_wiki printing code
Apologies. Was a trick. the default editor is displaying incorrectly. Mart :) On Feb 27, 1:55 am, mart wrote: > This reminds me, (and I could wrong - or could have been the editor > playing tricks), but now that I think if it, i noticed that some code > looked strange in some parts where I remember thinking probably quote > or a tic may be off... Seems that a couple of bits if code looked > commented out while near by comments looked "uncommented"... but > forgot to go back and look. > > Again, could have been just the editor or could have been reading it > too fast, then again my glasses are getting thicker and thicker... > I'll check and reply if anything turns up. > > Mart :) > > On Feb 26, 9:27 pm, Massimo Di Pierro > wrote: > > > > > > > > > hmmm... could be a bug. I will check this asap. I was planning to post > > a revised plugin_wiki tomoromow anyway. > > > On Feb 26, 1:10 pm, "Sebastian E. Ovide" > > wrote: > > > > Hi All, > > > > I'm testing the widget of the plugin_wiki in a view. > > > > I added > > > {{=plugin_wiki.widget('map',key='yrtable',table='auth_user',width=400, > > > height=200)}} after installing the plugin but instead of getting a map I'm > > > getting the JS code printed in the page ! > > > > If I see the page generated code, I can see: > > > > > > > > etc... > > > > any ideas ? > > > > thanks > > > -- > > > Sebastian E. Ovide