[web2py] videos not working in auth.wiki page
Is anyone using video links with auth.wiki ? I'm just getting the bottom bar with the Play button, but nothing else and nothing happens when I press Play. I did have success with plugin_wiki, but I would like to get it up and running with auth.wiki. I've tried with Chrome and Safari. Thanks --
Re: [web2py] Re: Some Scheduler questions
as you wish .( this is the line of thoughs that will never improve things. On Thursday, November 15, 2012 7:19:46 AM UTC+1, Johann Spies wrote: On 14 November 2012 16:13, Niphlod nip...@gmail.com javascript: wrote: and the log with the debug active says ? DEBUG:web2py.scheduler:looping... INFO:web2py.scheduler:nothing to do DEBUG:web2py.scheduler:sleeping... DEBUG:web2py.scheduler:looping... I have wasted too much time trying to get this working. I am going to use the operating system's cron. At least I know it works. Thanks for your time trying to help me. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) --
[web2py] Re: Cannot import module 'lpod'
I use an Ubuntu 12.04LTS, python 2.7 and web2py 2.2.1 lpod is installed in /usr/local/lib/python2.7/dist-packages, and it's an egg import lpod.document as oodoc - import error import lpod.document - import error import ldoc - no import error, but error document isn't found in lpod module And, I repeat, with python shell and web2py 1.99.7 it's ok (i make a new test this morning) And now, if i copy the lpod folder from the egg to : - web2py/site-packages folder - import error - web2py/applications/myapp/modules - it's ok !!! So i have a solution, but it's strange. Perhaps the lpod library is particular, because this code is ok inweb2py 2.2.1 : import dateutil.relativedelta as rd Le mercredi 14 novembre 2012 15:26:28 UTC+1, Massimo Di Pierro a écrit : Moreover. Where is lpod? How was it installed? On Wednesday, 14 November 2012 08:26:09 UTC-6, Massimo Di Pierro wrote: Does it work if you simply do: import lpod.document ? On Tuesday, 13 November 2012 04:37:43 UTC-6, omicron wrote: With web2py 1.99.7 this import was Ok : import lpod.document as oodoc But with version 2.2.1, I have this error : File /home/myhome/Applications/web2py/gluon/custom_import.py, line 77, in custom_importer raise ImportError, 'Cannot import module %s' % str(e) ImportError: Cannot import module 'lpod' But if I replace with this: import lpod It's ok !!! And, of course, in a python shell it's ok. Thanks --
[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next
Instead, perhaps we can just improve the documentation. Yes, it would be great if the documentation were changed to something like your explanation below, but clearer on the navbar bit. I believe you concluded back in July that the documentation could be clearer. you just have to set the referrer_actions argument to auth.navbar() appropriately auth.navbar(referrer_actions=None) did not work for Rob or for myself. Peter On Wednesday, 14 November 2012 19:27:35 UTC, Anthony wrote: If setting auth.user.settings to a URL stopped the bit of code that generates _next when default/user/register is 'called' then it would seem to fit in with developers expectations. Keep in mind, currently it is possible to enable referrers (i.e., the _next parameter in the URLs) while specifying a default redirect in case there is no referrer (i.e., via auth.settings.login_next). If we change the behavior, then we lose this capability and are limited to referrers only (with no default redirect) or a single fixed default only (with no referrers). So, we would be breaking backward compatibility and losing functionality. Instead, perhaps we can just improve the documentation. I don't think it's that complicated. Redirects from Auth pages are controlled via two methods: the _next parameter in the URL, and the auth.settings.[action]_next settings, with the former taking precedence. If you instead prefer the latter to take precedence, you just have to set the referrer_actions argument to auth.navbar() appropriately (or avoid using auth.navbar() altogether). Anthony --
[web2py] Web2py auth_membership table
Hi, I need only one auth_user form with the option to select the group membership in order to get a simple way to add users. I'm thinking override the auth_membership table use, and add a reference from auth_user directly to auth_group to achieve it, also formatting the output of the drop down menu with format='%(role)s' But I need statements like '@auth.requires_membership(group_id=1)' to secure my app... First, what do you think about my approach? Second, how can I get a feature like @auth.requires_role(role_id=1) that get the reference from my auth_user db table? Third, how can I add the format to the auth_group table if it was created by web2py? PD: In the past I was solve it using manual insert code or another approaches like suggested by Bruno here: http://rochacbruno.com.br/web2py-manage-users-and-membership-in-the-same-form/ but now I want achieve it more cleanly... Posted first in http://stackoverflow.com/questions/13387776/web2py-auth-membership-table --
Re: [web2py] Re: Some Scheduler questions
On 15 November 2012 10:49, Niphlod niph...@gmail.com wrote: as you wish .( this is the line of thoughs that will never improve things. True. I am working for a salary and have to get the job done. I would like to see web2py improving and from time to time I am trying to give feedback, but when I am busy at work I must choose the most effective way of getting things done. That is also the reason why I am resorting to executesql a lot of times because of DAL's and SQLFORM.grid's shortcomings. I might come back to the scheduler some time in the future maybe in my free time or when there is less pressure in my day job and then I will give feedback and try to figure out how to improve things. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) --
[web2py] CSS preprocessors Web2py
Hi guys, I'm thinking put my hands on some CSS preprocesor to get a centralized control over the stylesheets, but I'm wondering about how is the impact on the user experience, if it have a speed cost on page loading... Can somebody share some experience about that used with Web2py?? Thanks. Christian. --
[web2py] Web2Py and MS Access
There is very little information on this topic available on the internet. I have found one post where a user asked if Web2Py could be used with MS Access and a few users including Massimo suggested that it might be possible using the MSSql driver. There was no further information to suggest that this idea has been tested yet. While I understand the T-SQL is not entirely compatible with MS Access but most basic SQL statements such as Select, Update and Delete will work just fine. But in worst case I assume I should still be able to run raw SQL statements. If I wanted to Test Web2Py with PyODBC / MSSql to connect to MS Access what would the connection string look like? Bearing in mind that MS Access is a file based database and does not run behind an IP Address. Any help on this or anyone else's experience with Web2py and Access would be appreciated. Thanks Simon --
[web2py] Re: Web2Py and MS Access
I use SQLServer but have never tried Access (except as a linked server within SQL Server). I'd imagine the connection string would look something like this: db=SQLDB /examples/global/vars/SQLDB( 'mssql://user:user@server/directory/access.mdb') Have no idea how the whole user id/password part would work though...could try it without it and see if it flies... On Thursday, November 15, 2012 9:26:11 AM UTC-5, Simon Carr wrote: There is very little information on this topic available on the internet. I have found one post where a user asked if Web2Py could be used with MS Access and a few users including Massimo suggested that it might be possible using the MSSql driver. There was no further information to suggest that this idea has been tested yet. While I understand the T-SQL is not entirely compatible with MS Access but most basic SQL statements such as Select, Update and Delete will work just fine. But in worst case I assume I should still be able to run raw SQL statements. If I wanted to Test Web2Py with PyODBC / MSSql to connect to MS Access what would the connection string look like? Bearing in mind that MS Access is a file based database and does not run behind an IP Address. Any help on this or anyone else's experience with Web2py and Access would be appreciated. Thanks Simon --
Re: [web2py] Re: Migrating with postgres
I used 1.99.4 for two projects using apache, mod_wsgi, postgresql 8.4, psycopg2 on RHEL 6. But I never use Rocket or pg8000 driver and I didn't use temporary tables with these... Did use auth quite a bit, though. Anyway, this just goes towards how many different combinations need to be tested. Richard, Johann, any chance of doing basic sample apps that reliably recreate these migration issues...? That, combined with a bug ticket, would be the best approach to let more people look into this quickly. I think postgresql is quite popular in web2py world. Regards, Ales On Thursday, November 15, 2012 7:49:47 AM UTC+1, Johann Spies wrote: I am using the trunk code updated daily on my development computer and recently have had to kill web2py processes manually because of migration issues. I am also using postgresql and this happened regularly while experimenting with temporary tables. Example: I use 'create table x as select ... from ...' for some queries in postgresql to create temporary tables. When an error occurs in communicating with postgesql usually related to some migration issue, I have to kill the web2py process on operating system level using the -9 switch because of no response from web2py. Ctrl-C will do nothing and a normal kill also has no effect. Now I use migrate=False with fake-migrate to manage those tables. Regards Johann --
[web2py] Re: Web2Py and MS Access
Should the connection string not start db=DAL(.) If not how does this method of connection allow you to leverage the features of the Web2Py DAL Thanks Simon On Thursday, 15 November 2012 15:11:02 UTC, Willoughby wrote: I use SQLServer but have never tried Access (except as a linked server within SQL Server). I'd imagine the connection string would look something like this: db=SQLDB http://examples/global/vars/SQLDB( 'mssql://user:user@server/directory/access.mdb') Have no idea how the whole user id/password part would work though...could try it without it and see if it flies... On Thursday, November 15, 2012 9:26:11 AM UTC-5, Simon Carr wrote: There is very little information on this topic available on the internet. I have found one post where a user asked if Web2Py could be used with MS Access and a few users including Massimo suggested that it might be possible using the MSSql driver. There was no further information to suggest that this idea has been tested yet. While I understand the T-SQL is not entirely compatible with MS Access but most basic SQL statements such as Select, Update and Delete will work just fine. But in worst case I assume I should still be able to run raw SQL statements. If I wanted to Test Web2Py with PyODBC / MSSql to connect to MS Access what would the connection string look like? Bearing in mind that MS Access is a file based database and does not run behind an IP Address. Any help on this or anyone else's experience with Web2py and Access would be appreciated. Thanks Simon --
[web2py] Re: Web2Py and MS Access
Yea, sorry - we're still running an ancient version because of issues trying to upgrade. We're now looking at converting to Lightswitch instead. I believe it should be db=DAL for current versions and the connection string is normally mssql://user:pwd@server/database On Thursday, November 15, 2012 10:32:08 AM UTC-5, Simon Carr wrote: Should the connection string not start db=DAL(.) If not how does this method of connection allow you to leverage the features of the Web2Py DAL Thanks Simon On Thursday, 15 November 2012 15:11:02 UTC, Willoughby wrote: I use SQLServer but have never tried Access (except as a linked server within SQL Server). I'd imagine the connection string would look something like this: db=SQLDB http://examples/global/vars/SQLDB( 'mssql://user:user@server/directory/access.mdb') Have no idea how the whole user id/password part would work though...could try it without it and see if it flies... --
[web2py] Re: Web2Py and MS Access
i'd give it a try with the entire connection string (choosing also the right driver installed on your machine) db = DAL(mssql://Driver={Microsoft Access Driver (*.mdb)};Dbq= C:\mydatabase.mdb;Uid=Admin;Pwd=;) On Thursday, November 15, 2012 4:47:20 PM UTC+1, Willoughby wrote: Yea, sorry - we're still running an ancient version because of issues trying to upgrade. We're now looking at converting to Lightswitch instead. I believe it should be db=DAL for current versions and the connection string is normally mssql://user:pwd@server/database On Thursday, November 15, 2012 10:32:08 AM UTC-5, Simon Carr wrote: Should the connection string not start db=DAL(.) If not how does this method of connection allow you to leverage the features of the Web2Py DAL Thanks Simon On Thursday, 15 November 2012 15:11:02 UTC, Willoughby wrote: I use SQLServer but have never tried Access (except as a linked server within SQL Server). I'd imagine the connection string would look something like this: db=SQLDB http://examples/global/vars/SQLDB( 'mssql://user:user@server/directory/access.mdb') Have no idea how the whole user id/password part would work though...could try it without it and see if it flies... --
[web2py] Re: Web2Py and MS Access
Bat Man strikes again, That seems to work perfectly to make the actual connection, unfortunately :-( there is an immediate error in the SQL as it tries to create the auth tables. Looks like it would require a specific connection object writing. It's a shame because most companies will not allow database servers setting up like MySQL Server out side the confines of the IT Department. SQLite is often not scaleable enough but MS Access fits just nicely in the middle ground and is readily available on users machines. What are the chances of a MS Access adapter being written? I had a look at gluon.py but without help to get me started I don't think I could do it. Simon On Thursday, 15 November 2012 16:17:12 UTC, Niphlod wrote: i'd give it a try with the entire connection string (choosing also the right driver installed on your machine) db = DAL(mssql://Driver={Microsoft Access Driver (*.mdb)};Dbq= C:\mydatabase.mdb;Uid=Admin;Pwd=;) On Thursday, November 15, 2012 4:47:20 PM UTC+1, Willoughby wrote: Yea, sorry - we're still running an ancient version because of issues trying to upgrade. We're now looking at converting to Lightswitch instead. I believe it should be db=DAL for current versions and the connection string is normally mssql://user:pwd@server/database On Thursday, November 15, 2012 10:32:08 AM UTC-5, Simon Carr wrote: Should the connection string not start db=DAL(.) If not how does this method of connection allow you to leverage the features of the Web2Py DAL Thanks Simon On Thursday, 15 November 2012 15:11:02 UTC, Willoughby wrote: I use SQLServer but have never tried Access (except as a linked server within SQL Server). I'd imagine the connection string would look something like this: db=SQLDB http://examples/global/vars/SQLDB( 'mssql://user:user@server/directory/access.mdb') Have no idea how the whole user id/password part would work though...could try it without it and see if it flies... --
[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next
auth.navbar(referrer_actions=None) did not work for Rob or for myself. If that's the case, then please submit an issue in Google Codehttp://code.google.com/p/web2py/issues/list, as that would be a bug. Thanks. Anthony --
[web2py] Re: Web2Py and MS Access
maybe there are only column type and fk adapters to rewrite. the place is dal.py. Look into MSSQL2Adapter class that redefines slightly MSSQLAdapter. The same approach can be used for access. SQLite is often not scaleable enough but MS Access fits just nicely in the middle ground and is readily available on users machines. I'm having a hard time believing MS Access outfasts SQLite in speed. --
[web2py] wxpython app using web2py username and password
Hi, I'm creating a little desktop app as a companion to a web app I created with web2py. I'm using the default auth_user tables so I have an email address and encrypted password I can use for my desktop user to login. I've been looking for the code that does the login in web2py but can't seem to find it. Is there a recipe somewhere that would show me how to mimic the encryption that web2py uses so I compare encrypted passwords and use them to allow my desktop app users to login? -Jim --
[web2py] Re: wxpython app using web2py username and password
https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581) --
[web2py] Re: wxpython app using web2py username and password
Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581) --
[web2py] Re: Web2Py and MS Access
True - but most companies also block web servers internally - so you wouldn't get far either way. Unless you're doing a bundled stand alone...? If so, have you looked at SQL Server Express? It has a 'localdb' option if you want something you can run 'from the desktop'. On Thursday, November 15, 2012 11:46:23 AM UTC-5, Simon Carr wrote: Bat Man strikes again, That seems to work perfectly to make the actual connection, unfortunately :-( there is an immediate error in the SQL as it tries to create the auth tables. Looks like it would require a specific connection object writing. It's a shame because most companies will not allow database servers setting up like MySQL Server out side the confines of the IT Department. SQLite is often not scaleable enough but MS Access fits just nicely in the middle ground and is readily available on users machines. What are the chances of a MS Access adapter being written? I had a look at gluon.py but without help to get me started I don't think I could do it. Simon On Thursday, 15 November 2012 16:17:12 UTC, Niphlod wrote: i'd give it a try with the entire connection string (choosing also the right driver installed on your machine) db = DAL(mssql://Driver={Microsoft Access Driver (*.mdb)};Dbq= C:\mydatabase.mdb;Uid=Admin;Pwd=;) On Thursday, November 15, 2012 4:47:20 PM UTC+1, Willoughby wrote: Yea, sorry - we're still running an ancient version because of issues trying to upgrade. We're now looking at converting to Lightswitch instead. I believe it should be db=DAL for current versions and the connection string is normally mssql://user:pwd@server/database On Thursday, November 15, 2012 10:32:08 AM UTC-5, Simon Carr wrote: Should the connection string not start db=DAL(.) If not how does this method of connection allow you to leverage the features of the Web2Py DAL Thanks Simon On Thursday, 15 November 2012 15:11:02 UTC, Willoughby wrote: I use SQLServer but have never tried Access (except as a linked server within SQL Server). I'd imagine the connection string would look something like this: db=SQLDB http://examples/global/vars/SQLDB( 'mssql://user:user@server/directory/access.mdb') Have no idea how the whole user id/password part would work though...could try it without it and see if it flies... --
Re: [web2py] REF: lambda table variable passing error
I am not pretty experienced with SQLFORM.grid, but the way you use bootstrap modal seems wrong... About the id problem, I notice that one time use row.id and the other row.office.id maybe your problem come from there?! Richard On Thu, Nov 15, 2012 at 12:58 AM, Teddy Nyambe software@gmail.comwrote: Hi, I have the following action in the controller, doing a join to display office name and a reference to department of department name to which office belongs...but i have an error in the link since I have a modal window am opening to edit/add/delete details...this is the error: type 'exceptions.AttributeError' 'Row' object has no attribute 'id' def office(): db.office.id.readable = False query = ((db.office.department == db.department.id)) #((db.contact.date_of_birth “1990-11-18”)) fields = (db.office.name, db.department.name) link = [lambda row: A('Edit', _class='btn', _role='button', _onclick='dept_edit('+str(row.office.id)+');',**{'_data-toggle':'modal'}) ,lambda row: A('Delete', _class='btn', _role='button', _onclick='dept_delete('+str(row.id)+');',**{'_data-toggle':'modal'})] headers = {'db.office.name': 'Office Name','db.department.name': 'Department'} default_sort_order=[db.office.name] form = SQLFORM.grid(query=query, headers=headers, orderby=default_sort_order ,links=link, create=False, deletable=True, editable=False, maxtextlength=64, paginate=25) return dict(form=form) How do I pass an id of a row in lambda for the link parameter of the SQLFORM.grid. Been stuck with this error for a day now!! Kind regards, Teddy L. -- --
[web2py] Re: Web2Py and MS Access
You may be right for speed but I have never done any testing so I couldn't comment, but my point was regarding the ability to have concurrent writes, which I should have made clearer. As it happens the size of application I am developing this would not be a problem, but as I have learned to my peril over the years who knows how the same application will be used next year. On Thursday, 15 November 2012 17:02:04 UTC, Niphlod wrote: maybe there are only column type and fk adapters to rewrite. the place is dal.py. Look into MSSQL2Adapter class that redefines slightly MSSQLAdapter. The same approach can be used for access. SQLite is often not scaleable enough but MS Access fits just nicely in the middle ground and is readily available on users machines. I'm having a hard time believing MS Access outfasts SQLite in speed. --
Re: [web2py] Re: Multi-language website with GAE + parameter-based system
Hi howesc, Testing the regex I found out the error. Intead of: url: /(?Pa.+?)/static/\w\{2}?/(?Pb.+) it should be: url: /(?Pa.+?)/static/\w{2}?/(?Pb.+) So a backslash was making the difference! :P Thank you very much for your help, now everything works. Cheers, David On 15 November 2012 02:42, howesc how...@umich.edu wrote: the error is not obvious to me. :( can you verify that your regex matches your URL? On Tuesday, November 13, 2012 6:01:09 AM UTC-8, David Sorrentino wrote: Hi howesc, Thanks for your reply! I tried to set the regex for my needs, but I guess that I am wrong in something. I edited the regex in this way: - url: /(?Pa.+?)/static/\w\{2}?/(?**Pb.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional Now, instead of an error, I get 2 warnings for each static file: WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/en/**css/bootstrap-responsive.min.**css WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/css/**bootstrap-responsive.min.css Any thoughts? Cheers, David On 12 November 2012 23:03, howesc how...@umich.edu wrote: i don't know the full deal with the routerbut it looks like the path to the static files is incorrect (notice the 'en' in the path). you can strip this out in app.yaml (my example strips out a random cache busting param after the 'static/' in the path, you can modify the regex to meet your needs): - url: /(?Pa.+?)/static/.*?/(?Pb.**+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional expiration: 1d cfh On Monday, November 12, 2012 7:19:32 AM UTC-8, David Sorrentino wrote: Hello everybody! :) I am developing a multi-language website deployed on GAE. For my routes.py I would like to use this configuration, shown on the online book (http://web2py.com/books/**defau**lt/chapter/29/04#** Parameter-**based-systemhttp://web2py.com/books/default/chapter/29/04#Parameter-based-system ): routers = dict( BASE = dict(default_application='**myap**p'), myapp = dict(languages=['en', 'it', 'jp'], default_language='en'), ) However, it looks like I am having some troubles with loading the static files. Indeed static files are not loaded and the console shows the following error: [Errno 2] No such file or directory: '/home/dapids/web2py/**applicati** ons/myapp/en/static/**css/**bootstrap-responsive.min.**css' Am I doing something wrong? Cheers, David -- -- --
[web2py] Re: Web2Py and MS Access
You are right, but with web2py you have the option of giving each user a copy web2py (which does not need installing - just unzip), run the webserver on localhost only and point everyone at the same database on a shared drive. This is why I need Access to allow concurrent users. I know it's not perfect, but when you are working in a local IT department reacting to local business requirements with one hand tied behind your back, pepper spray in your eyes and pair of electrodes on your testicles because of Corporate IT restrictions, you have to try and think outside of the box. Simon On Thursday, 15 November 2012 18:04:23 UTC, Willoughby wrote: True - but most companies also block web servers internally - so you wouldn't get far either way. Unless you're doing a bundled stand alone...? If so, have you looked at SQL Server Express? It has a 'localdb' option if you want something you can run 'from the desktop'. On Thursday, November 15, 2012 11:46:23 AM UTC-5, Simon Carr wrote: Bat Man strikes again, That seems to work perfectly to make the actual connection, unfortunately :-( there is an immediate error in the SQL as it tries to create the auth tables. Looks like it would require a specific connection object writing. It's a shame because most companies will not allow database servers setting up like MySQL Server out side the confines of the IT Department. SQLite is often not scaleable enough but MS Access fits just nicely in the middle ground and is readily available on users machines. What are the chances of a MS Access adapter being written? I had a look at gluon.py but without help to get me started I don't think I could do it. Simon On Thursday, 15 November 2012 16:17:12 UTC, Niphlod wrote: i'd give it a try with the entire connection string (choosing also the right driver installed on your machine) db = DAL(mssql://Driver={Microsoft Access Driver (*.mdb)};Dbq= C:\mydatabase.mdb;Uid=Admin;Pwd=;) On Thursday, November 15, 2012 4:47:20 PM UTC+1, Willoughby wrote: Yea, sorry - we're still running an ancient version because of issues trying to upgrade. We're now looking at converting to Lightswitch instead. I believe it should be db=DAL for current versions and the connection string is normally mssql://user:pwd@server/database On Thursday, November 15, 2012 10:32:08 AM UTC-5, Simon Carr wrote: Should the connection string not start db=DAL(.) If not how does this method of connection allow you to leverage the features of the Web2Py DAL Thanks Simon On Thursday, 15 November 2012 15:11:02 UTC, Willoughby wrote: I use SQLServer but have never tried Access (except as a linked server within SQL Server). I'd imagine the connection string would look something like this: db=SQLDB http://examples/global/vars/SQLDB( 'mssql://user:user@server/directory/access.mdb') Have no idea how the whole user id/password part would work though...could try it without it and see if it flies... --
Re: [web2py] REF: lambda table variable passing error
Thanx, it was as you pointed out. But how can I correctly use the modal window. It's working but the code is quiet dirty. On Nov 15, 2012 9:03 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: I am not pretty experienced with SQLFORM.grid, but the way you use bootstrap modal seems wrong... About the id problem, I notice that one time use row.id and the other row.office.id maybe your problem come from there?! Richard On Thu, Nov 15, 2012 at 12:58 AM, Teddy Nyambe software@gmail.comwrote: Hi, I have the following action in the controller, doing a join to display office name and a reference to department of department name to which office belongs...but i have an error in the link since I have a modal window am opening to edit/add/delete details...this is the error: type 'exceptions.AttributeError' 'Row' object has no attribute 'id' def office(): db.office.id.readable = False query = ((db.office.department == db.department.id)) #((db.contact.date_of_birth “1990-11-18”)) fields = (db.office.name, db.department.name) link = [lambda row: A('Edit', _class='btn', _role='button', _onclick='dept_edit('+str(row.office.id)+');',**{'_data-toggle':'modal'}) ,lambda row: A('Delete', _class='btn', _role='button', _onclick='dept_delete('+str(row.id)+');',**{'_data-toggle':'modal'})] headers = {'db.office.name': 'Office Name','db.department.name': 'Department'} default_sort_order=[db.office.name] form = SQLFORM.grid(query=query, headers=headers, orderby=default_sort_order ,links=link, create=False, deletable=True, editable=False, maxtextlength=64, paginate=25) return dict(form=form) How do I pass an id of a row in lambda for the link parameter of the SQLFORM.grid. Been stuck with this error for a day now!! Kind regards, Teddy L. -- -- --
[web2py] Multilanguage website
Hi folks! :) I am here for asking you an opinion. Since I am developing a multilanguage website, I am wondering if there is a best practice for managing the translation of the content. I mean, now I added in my routers: myapp = dict(languages=['en', 'it', 'pl'], default_language='en') so I have the chosen language in *request.uri_language* and I can force the translation in every page. In my mind this applies well to the translation of the interface, but when it comes to the content it means that I have to write all the content of the pages in the dictionaries which are in the folder *languages*. Is that correct? Or should I put the content on txt files and select them in the controller on the basis of the chosen language? How would you manage this? Thanks in advance for your precious opinions. Cheers, David --
Re: [web2py] REF: lambda table variable passing error
You need to pass a form to the modal... Do you want to embed create, read and update form into modal? If so, I am not sure if that SQLFORM.grid is the best option or if there is a short cut... But basically to embed something in modal, you need a form... The way to get your form is to use web2py component. You can do that with LOAD command in your view then you just need to wrap those component into modal bootstrap code... And bind a trigger to a botton to make the modal appears... I try to use modal last week or the one before, I am not sure why, but the form tag of the form was clipped away so when I was submitting the form embedded into modal it was submitting all the form included into the page... Didn't investigate (don't have time)... Richard On Thu, Nov 15, 2012 at 2:16 PM, Teddy Nyambe software@gmail.comwrote: Thanx, it was as you pointed out. But how can I correctly use the modal window. It's working but the code is quiet dirty. On Nov 15, 2012 9:03 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: I am not pretty experienced with SQLFORM.grid, but the way you use bootstrap modal seems wrong... About the id problem, I notice that one time use row.id and the other row.office.id maybe your problem come from there?! Richard On Thu, Nov 15, 2012 at 12:58 AM, Teddy Nyambe software@gmail.comwrote: Hi, I have the following action in the controller, doing a join to display office name and a reference to department of department name to which office belongs...but i have an error in the link since I have a modal window am opening to edit/add/delete details...this is the error: type 'exceptions.AttributeError' 'Row' object has no attribute 'id' def office(): db.office.id.readable = False query = ((db.office.department == db.department.id)) #((db.contact.date_of_birth “1990-11-18”)) fields = (db.office.name, db.department.name) link = [lambda row: A('Edit', _class='btn', _role='button', _onclick='dept_edit('+str(row.office.id )+');',**{'_data-toggle':'modal'}) ,lambda row: A('Delete', _class='btn', _role='button', _onclick='dept_delete('+str(row.id)+');',**{'_data-toggle':'modal'})] headers = {'db.office.name': 'Office Name','db.department.name': 'Department'} default_sort_order=[db.office.name] form = SQLFORM.grid(query=query, headers=headers, orderby=default_sort_order ,links=link, create=False, deletable=True, editable=False, maxtextlength=64, paginate=25) return dict(form=form) How do I pass an id of a row in lambda for the link parameter of the SQLFORM.grid. Been stuck with this error for a day now!! Kind regards, Teddy L. -- -- -- --
Re: [web2py] Multilanguage website
strings, small words, titles can be used with the T operator for full blown articles, posts, etc you can use T too, but if your website is basically content (posts, manuals, etc) it may be a lot easier to maintain a default content (file,db row, etc) and all the translations that, if not found, fall back to the default english content page. On Thursday, November 15, 2012 8:26:02 PM UTC+1, David Sorrentino wrote: Hi folks! :) I am here for asking you an opinion. Since I am developing a multilanguage website, I am wondering if there is a best practice for managing the translation of the content. I mean, now I added in my routers: myapp = dict(languages=['en', 'it', 'pl'], default_language='en') so I have the chosen language in *request.uri_language* and I can force the translation in every page. In my mind this applies well to the translation of the interface, but when it comes to the content it means that I have to write all the content of the pages in the dictionaries which are in the folder *languages*. Is that correct? Or should I put the content on txt files and select them in the controller on the basis of the chosen language? How would you manage this? Thanks in advance for your precious opinions. Cheers, David --
Re: [web2py] REF: lambda table variable passing error
I think that the error refers to the id column being readable=False, that is not supported. On Thursday, November 15, 2012 8:16:43 PM UTC+1, software.ted wrote: Thanx, it was as you pointed out. But how can I correctly use the modal window. It's working but the code is quiet dirty. On Nov 15, 2012 9:03 PM, Richard Vézina ml.richa...@gmail.comjavascript: wrote: I am not pretty experienced with SQLFORM.grid, but the way you use bootstrap modal seems wrong... About the id problem, I notice that one time use row.id and the other row.office.id maybe your problem come from there?! Richard On Thu, Nov 15, 2012 at 12:58 AM, Teddy Nyambe softwa...@gmail.comjavascript: wrote: Hi, I have the following action in the controller, doing a join to display office name and a reference to department of department name to which office belongs...but i have an error in the link since I have a modal window am opening to edit/add/delete details...this is the error: type 'exceptions.AttributeError' 'Row' object has no attribute 'id' def office(): db.office.id.readable = False query = ((db.office.department == db.department.id)) #((db.contact.date_of_birth “1990-11-18”)) fields = (db.office.name, db.department.name) link = [lambda row: A('Edit', _class='btn', _role='button', _onclick='dept_edit('+str(row.office.id )+');',**{'_data-toggle':'modal'}) ,lambda row: A('Delete', _class='btn', _role='button', _onclick='dept_delete('+str(row.id)+');',**{'_data-toggle':'modal'})] headers = {'db.office.name': 'Office Name','db.department.name': 'Department'} default_sort_order=[db.office.name] form = SQLFORM.grid(query=query, headers=headers, orderby=default_sort_order ,links=link, create=False, deletable=True, editable=False, maxtextlength=64, paginate=25) return dict(form=form) How do I pass an id of a row in lambda for the link parameter of the SQLFORM.grid. Been stuck with this error for a day now!! Kind regards, Teddy L. -- -- --
Re: [web2py] REF: lambda table variable passing error
That a major issue to me to migrate to SQLFORM.grid! I would not show the ID of the record to my user. I had a similar issue with crud.select or SQLTABLE in the pass and solve it like this : db[request.args(0)].fieldThatServeAsIDRepresent.represent=\ lambda fieldThatServeAsIDRepresent, record: A(some_dict[fieldThatServeAsIDRepresent],\ _href=URL(r=request,f='read',args=(request.args(0),str( record.id form = crud.select(db.table) form = remove_id_column_func(form) But I think that this approach doesn't work with SQLFORM.grid since it really need the ID Richard On Thu, Nov 15, 2012 at 2:42 PM, Niphlod niph...@gmail.com wrote: I think that the error refers to the id column being readable=False, that is not supported. On Thursday, November 15, 2012 8:16:43 PM UTC+1, software.ted wrote: Thanx, it was as you pointed out. But how can I correctly use the modal window. It's working but the code is quiet dirty. On Nov 15, 2012 9:03 PM, Richard Vézina ml.richa...@gmail.com wrote: I am not pretty experienced with SQLFORM.grid, but the way you use bootstrap modal seems wrong... About the id problem, I notice that one time use row.id and the other row.office.id maybe your problem come from there?! Richard On Thu, Nov 15, 2012 at 12:58 AM, Teddy Nyambe softwa...@gmail.comwrote: Hi, I have the following action in the controller, doing a join to display office name and a reference to department of department name to which office belongs...but i have an error in the link since I have a modal window am opening to edit/add/delete details...this is the error: type 'exceptions.AttributeError' 'Row' object has no attribute 'id' def office(): db.office.id.readable = False query = ((db.office.department == db.department.id)) #((db.contact.date_of_birth “1990-11-18”)) fields = (db.office.name, db.department.name) link = [lambda row: A('Edit', _class='btn', _role='button', _onclick='dept_edit('+str(row.**office.id http://row.office.id )+');',**{'_data-**toggle':'modal'}) ,lambda row: A('Delete', _class='btn', _role='button', _onclick='dept_delete('+str(ro**w.id http://row.id )+');',**{'_data-toggle':'**modal'})] headers = {'db.office.name': 'Office Name','db.department.name': 'Department'} default_sort_order=[db.office.**name http://db.office.name] form = SQLFORM.grid(query=query, headers=headers, orderby=default_sort_order ,links=link, create=False, deletable=True, editable=False, maxtextlength=64, paginate=25) return dict(form=form) How do I pass an id of a row in lambda for the link parameter of the SQLFORM.grid. Been stuck with this error for a day now!! Kind regards, Teddy L. -- -- -- --
[web2py] Re: Web2Py and MS Access
You may be right for speed but I have never done any testing so I couldn't comment, but my point was regarding the ability to have concurrent writes, which I should have made clearer. As it happens the size of application I am developing this would not be a problem, but as I have learned to my peril over the years who knows how the same application will be used next year. That was more or less my point. I don't know how well access supports concurrent writes better than SQLite. SQLite holds a block on every update/write to the db, but with default values, if the operation takes less than 5 seconds (the default timeout variable, that you can enlarge using driver_args={'timeout': 30}) the problem of locking doesn't show up. What is instead super-valid from your standpoint is that an access db shared on a Windows network is safer than SQLite, because it seems to use some internals at its advantage. If instead your network is samba or any other network-ish mounted disk (webdav, samba, etc) concurrent writes will not be handled so well. Also, sharing over network a file can be a lot less speedier than having data exchanged with a normal db server. All things considered, you may try to convince your IT department than sparing an uncostly 128mb VM holding mysql or postgresql will make everyone's life better. --
[web2py] Re: wxpython app using web2py username and password
ehm validators.py (if not all, just crypt and lazycrypt, plus Validator original class), utils.py and pbkdf2 is all you need. On Thursday, November 15, 2012 6:32:03 PM UTC+1, Jim S wrote: Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581) --
Re: [web2py] REF: lambda table variable passing error
showing plainly is one thing, but internals need to pass around the id value as a pointer to the recordhow else ? --
Re: [web2py] REF: lambda table variable passing error
I meant if you don't want to show the id step1: there's the fields parameter that you can pass to the grid: the id is not shown on the main grid step 2: Don't show it in the edit form. easy-peasy: editargs={'showid' : False} . but the number of the id will be shown no matter what, e.g. in the URL bar when you modify the record, in the tr id= and so on --
Re: [web2py] Multilanguage website
Hey Niphlod, Thank you for replying. I did understand that for the interface it's beneficial to use T. However I am not that sure I correctly understood your advice about the content like posts, manuals, etc. In practice you mean that I should have a default content and the respective translations on files, db row, etc, and read them according to the chosen language, right? Thanks one more time. Best, David On 15 November 2012 20:40, Niphlod niph...@gmail.com wrote: strings, small words, titles can be used with the T operator for full blown articles, posts, etc you can use T too, but if your website is basically content (posts, manuals, etc) it may be a lot easier to maintain a default content (file,db row, etc) and all the translations that, if not found, fall back to the default english content page. On Thursday, November 15, 2012 8:26:02 PM UTC+1, David Sorrentino wrote: Hi folks! :) I am here for asking you an opinion. Since I am developing a multilanguage website, I am wondering if there is a best practice for managing the translation of the content. I mean, now I added in my routers: myapp = dict(languages=['en', 'it', 'pl'], default_language='en') so I have the chosen language in *request.uri_language* and I can force the translation in every page. In my mind this applies well to the translation of the interface, but when it comes to the content it means that I have to write all the content of the pages in the dictionaries which are in the folder *languages*. Is that correct? Or should I put the content on txt files and select them in the controller on the basis of the chosen language? How would you manage this? Thanks in advance for your precious opinions. Cheers, David -- --
Re: [web2py] REF: lambda table variable passing error
Hi, what I did to hide unwanted fields in the gride was to pass a false to the readable property of the field like so: db.mytable.myfield_to_hide.readable=false As for the grid, does it come with add, edit and delete functionality, what hv seen is only the view details button. I will post my code a little while so that you guys can dissect it, Teddy On Nov 15, 2012 10:10 PM, Niphlod niph...@gmail.com wrote: I meant if you don't want to show the id step1: there's the fields parameter that you can pass to the grid: the id is not shown on the main grid step 2: Don't show it in the edit form. easy-peasy: editargs={'showid' : False} . but the number of the id will be shown no matter what, e.g. in the URL bar when you modify the record, in the tr id= and so on -- --
Re: [web2py] REF: lambda table variable passing error
Off course the id is in the URL. I wasn't know about showid : false... As I wrote I don't know pretty well SQLFORM.grid, I didn't have time to learn it properly and it was changing constantly, so I postpone migration the time the api freezed... :) Richard On Thu, Nov 15, 2012 at 3:10 PM, Niphlod niph...@gmail.com wrote: I meant if you don't want to show the id step1: there's the fields parameter that you can pass to the grid: the id is not shown on the main grid step 2: Don't show it in the edit form. easy-peasy: editargs={'showid' : False} . but the number of the id will be shown no matter what, e.g. in the URL bar when you modify the record, in the tr id= and so on -- --
Re: [web2py] Re: Getting error class 'sqlite3.OperationalError' near interval_time: syntax error
This may work on sqlite but I am not sure. Anyway it is not portable. It should be possible to use .epoch() import time query = (db.status.updated_on.epoch() + db.status.interval_time*60) time.time() On Wednesday, 14 November 2012 11:17:40 UTC-6, Paolo Caruccio wrote: Please try: query = Expression(db,interval_time (strftime('%M','now') - strftime('%M', updated_on))) On the page suggested by Niphlod we read: Compute the number of seconds between two dates: SELECT strftime('%s','now') - strftime('%s','2004-01-01 02:34:56'); So by replacing '%s' with '%M' we obtain the difference in minutes between two dates. Il giorno mercoledì 14 novembre 2012 12:13:03 UTC+1, Amit ha scritto: 100% correct :) , now facing problem of replacing the query with sqlite compatible query : MySql query were: *query = Expression(db,date_sub(now(),interval interval_time minute) updated_on)* where interval_time field is integer field which will be considered to take interval in minutes for e.g. if user wants to save the interval time is 1 hour then he has to enter it in minutes means 60 minutes. Now problem is when i tried to replace the above query with sqlite compitible query like below and pass to the db to get the required records: *query = Expression(db,date('now','-interval_time minutes') updated_on)* it returns nothing. So can you please help me out write the above query in Sqlite. Thanks, Amit On Wed, Nov 14, 2012 at 3:36 PM, Niphlod nip...@gmail.com wrote: Il giorno mercoledì 14 novembre 2012 09:51:43 UTC+1, Amit ha scritto: Hi, I am getting error *class 'sqlite3.OperationalError' near interval_time: syntax error* syntax error points to something around interval_time.. my bet is on date_sub() not supported by sqlite http://www.sqlite.org/cvstrac/wiki/wiki?p=DateAndTimeFunctions -- --
[web2py] Re: auth.wiki( extra=dict() )
In trunk. Please check it. On Wednesday, 14 November 2012 15:16:32 UTC-6, villas wrote: There is this really long thread, but as far as I can see, no one seems to have answered a main question of the OP. https://groups.google.com/d/topic/web2py/r7qMRK2Eir0/discussion The question is: can we please have the 'extra' dict for auth.wiki() so that this can be passed to Markmin? I guess it wouldn't do any harm? Regards, David --
Re: [web2py] Multilanguage website
I'd do the following 1. choose a storage option for your content (you may want to use a simple table with a 'text' field for editing online, or code something to save the content to a txt file) 2. code something that inspects the uri_language and does (semi-programming-language): if exists nameoftherequestedarticle: if uri_language in translationsofthearticle: content = translatedarticle else: content = originalarticle (english ?) else: raise 404 --
[web2py] Re: Web2Py and MS Access
So would I just subclass MSSQL2Adapter and then change types dictionary values to match what MS Access expects to see? Once done, what do I have to do in order to make something like db=DAL('msaccess://.') available to use? Thanks Simon On Thursday, 15 November 2012 17:02:04 UTC, Niphlod wrote: maybe there are only column type and fk adapters to rewrite. the place is dal.py. Look into MSSQL2Adapter class that redefines slightly MSSQLAdapter. The same approach can be used for access. SQLite is often not scaleable enough but MS Access fits just nicely in the middle ground and is readily available on users machines. I'm having a hard time believing MS Access outfasts SQLite in speed. --
[web2py] Re: Web2Py and MS Access
just extend the ADAPTERS dict in dal.py http://web2py.com/books/default/chapter/29/06#Note-on-new-DAL-and-adapters On Thursday, November 15, 2012 10:12:45 PM UTC+1, Simon Carr wrote: So would I just subclass MSSQL2Adapter and then change types dictionary values to match what MS Access expects to see? Once done, what do I have to do in order to make something like db=DAL('msaccess://.') available to use? Thanks Simon On Thursday, 15 November 2012 17:02:04 UTC, Niphlod wrote: maybe there are only column type and fk adapters to rewrite. the place is dal.py. Look into MSSQL2Adapter class that redefines slightly MSSQLAdapter. The same approach can be used for access. SQLite is often not scaleable enough but MS Access fits just nicely in the middle ground and is readily available on users machines. I'm having a hard time believing MS Access outfasts SQLite in speed. --
Re: [web2py] REF: lambda table variable passing error
...so for features like SQLFORM.grid what r u alternatively using? On Nov 15, 2012 10:29 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Off course the id is in the URL. I wasn't know about showid : false... As I wrote I don't know pretty well SQLFORM.grid, I didn't have time to learn it properly and it was changing constantly, so I postpone migration the time the api freezed... :) Richard On Thu, Nov 15, 2012 at 3:10 PM, Niphlod niph...@gmail.com wrote: I meant if you don't want to show the id step1: there's the fields parameter that you can pass to the grid: the id is not shown on the main grid step 2: Don't show it in the edit form. easy-peasy: editargs={'showid' : False} . but the number of the id will be shown no matter what, e.g. in the URL bar when you modify the record, in the tr id= and so on -- -- --
Re: [web2py] REF: lambda table variable passing error
Datatables plugins... But it is not the same and you require to learn it api. The only thing I really miss is the query builder of SQLFORM.grid. With Datatables you have only AND no OR and you can't specify to filter for particular column as far as I know. Richard On Thu, Nov 15, 2012 at 5:02 PM, Teddy Nyambe software@gmail.comwrote: ...so for features like SQLFORM.grid what r u alternatively using? On Nov 15, 2012 10:29 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Off course the id is in the URL. I wasn't know about showid : false... As I wrote I don't know pretty well SQLFORM.grid, I didn't have time to learn it properly and it was changing constantly, so I postpone migration the time the api freezed... :) Richard On Thu, Nov 15, 2012 at 3:10 PM, Niphlod niph...@gmail.com wrote: I meant if you don't want to show the id step1: there's the fields parameter that you can pass to the grid: the id is not shown on the main grid step 2: Don't show it in the edit form. easy-peasy: editargs={'showid' : False} . but the number of the id will be shown no matter what, e.g. in the URL bar when you modify the record, in the tr id= and so on -- -- -- --
Re: [web2py] REF: lambda table variable passing error
You have to build your own button to redirect on read, create, update if you want this behavior... Not sure what could be the best way to implement that though maybe virtual field should be used to add column to this purpose... Richard On Thu, Nov 15, 2012 at 5:11 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Datatables plugins... But it is not the same and you require to learn it api. The only thing I really miss is the query builder of SQLFORM.grid. With Datatables you have only AND no OR and you can't specify to filter for particular column as far as I know. Richard On Thu, Nov 15, 2012 at 5:02 PM, Teddy Nyambe software@gmail.comwrote: ...so for features like SQLFORM.grid what r u alternatively using? On Nov 15, 2012 10:29 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Off course the id is in the URL. I wasn't know about showid : false... As I wrote I don't know pretty well SQLFORM.grid, I didn't have time to learn it properly and it was changing constantly, so I postpone migration the time the api freezed... :) Richard On Thu, Nov 15, 2012 at 3:10 PM, Niphlod niph...@gmail.com wrote: I meant if you don't want to show the id step1: there's the fields parameter that you can pass to the grid: the id is not shown on the main grid step 2: Don't show it in the edit form. easy-peasy: editargs={'showid' : False} . but the number of the id will be shown no matter what, e.g. in the URL bar when you modify the record, in the tr id= and so on -- -- -- --
[web2py] Re: wxpython app using web2py username and password
My main concern is that with this being a desktop app that I don't want to have to keep the latest versions of those files on the client machines. I switched my desktop authorization to read the Windows username and then match it to a username in the auth_user table and rely on the Windows authentication to ensure that user is logged in properly. I validate that they are on the proper domain and they are logged in with an id in the table. Now I don't need to worry about keep those files current on multiple clients. -Jim On Thursday, November 15, 2012 2:01:12 PM UTC-6, Niphlod wrote: ehm validators.py (if not all, just crypt and lazycrypt, plus Validator original class), utils.py and pbkdf2 is all you need. On Thursday, November 15, 2012 6:32:03 PM UTC+1, Jim S wrote: Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581) --
Re: [web2py] Re: Multi-language website with GAE + parameter-based system
glad it is working! On Thursday, November 15, 2012 11:10:50 AM UTC-8, David Sorrentino wrote: Hi howesc, Testing the regex I found out the error. Intead of: url: /(?Pa.+?)/static/\w\{2}?/(?Pb.+) it should be: url: /(?Pa.+?)/static/\w{2}?/(?Pb.+) So a backslash was making the difference! :P Thank you very much for your help, now everything works. Cheers, David On 15 November 2012 02:42, howesc how...@umich.edu javascript: wrote: the error is not obvious to me. :( can you verify that your regex matches your URL? On Tuesday, November 13, 2012 6:01:09 AM UTC-8, David Sorrentino wrote: Hi howesc, Thanks for your reply! I tried to set the regex for my needs, but I guess that I am wrong in something. I edited the regex in this way: - url: /(?Pa.+?)/static/\w\{2}?/(?**Pb.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional Now, instead of an error, I get 2 warnings for each static file: WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/en/**css/bootstrap-responsive.min.**css WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/css/**bootstrap-responsive.min.css Any thoughts? Cheers, David On 12 November 2012 23:03, howesc how...@umich.edu wrote: i don't know the full deal with the routerbut it looks like the path to the static files is incorrect (notice the 'en' in the path). you can strip this out in app.yaml (my example strips out a random cache busting param after the 'static/' in the path, you can modify the regex to meet your needs): - url: /(?Pa.+?)/static/.*?/(?Pb.**+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional expiration: 1d cfh On Monday, November 12, 2012 7:19:32 AM UTC-8, David Sorrentino wrote: Hello everybody! :) I am developing a multi-language website deployed on GAE. For my routes.py I would like to use this configuration, shown on the online book (http://web2py.com/books/**defau**lt/chapter/29/04#** Parameter-**based-systemhttp://web2py.com/books/default/chapter/29/04#Parameter-based-system ): routers = dict( BASE = dict(default_application='**myap**p'), myapp = dict(languages=['en', 'it', 'jp'], default_language='en'), ) However, it looks like I am having some troubles with loading the static files. Indeed static files are not loaded and the console shows the following error: [Errno 2] No such file or directory: '/home/dapids/web2py/**applicati* *ons/myapp/en/static/**css/**bootstrap-responsive.min.**css' Am I doing something wrong? Cheers, David -- -- --
[web2py] Re: Web2Py and MS Access
Thank you, Will take a look at it tomorrow and let you know how I got on. It would be nice if I had something to commit back to the project. Simon On Thursday, 15 November 2012 21:24:43 UTC, Niphlod wrote: subclass MSSQLAdapter (creating, e.g. MSAccessAdapter(MSSQLAdapter)), then just extend the ADAPTERS dict in dal.py 'oracle': OracleAdapter, 'mssql': MSSQLAdapter, 'mssql2': MSSQL2Adapter, *'msaccess': MSAccessAdapter,* 'sybase': SybaseAdapter, http://web2py.com/books/default/chapter/29/06#Note-on-new-DAL-and-adapters --
[web2py] Re: Does web2py Cache Auth Queries
So... What can I do to make than faster? Or should I not be using has_permission each time I need to know which permission logged in user have? Em quarta-feira, 2 de março de 2011 12h48min55s UTC-3, Massimo Di Pierro escreveu: They are not cached. On Mar 2, 9:22 am, Ross Peoples ross.peop...@gmail.com wrote: I am finding myself using auth.has_membership() and auth.has_permission() quite often in a module. Are either of these cached? I looked through the Auth code a bit and didn't see anything, so I was wondering it if did it somewhere else. If not then I should probably write my own has_membership/has_permission function that returns a cached value or calls the Auth methods. --
[web2py] Re: New error after installing 2.2.1 version
Will look asap http://code.google.com/p/web2py/issues/detail?id=1169thanks=1169ts=1353029906 On Wednesday, 14 November 2012 19:03:59 UTC-6, Julien Courteau wrote: Hello Massimo! I send you the complete traceback (see the attach file). Thanks a lot for web2py and your kindness for taking the time to look at that strange problem! --
[web2py] Re: Importing installed modules
You should not do this: sys.path.append('/home/www/lib/python2.6/M2Crypto-0.21.1-py2.6-linux-i686.egg') It will make the path longer at every http request. If MCryption is pip installed. web2py should just see it. On Wednesday, 14 November 2012 22:28:30 UTC-6, Richard Penman wrote: I installed a module with pip to: /home/www/lib/python2.6/M2Crypto-0.21.1-py2.6-linux-i686.egg When using python directly I can import this module. How should I help web2py find this? For now I have this in my model: import sys sys.path.append('/home/www/lib/python2.6/M2Crypto-0.21.1-py2.6-linux-i686.egg') --
[web2py] Re: videos not working in auth.wiki page
what video type. Are the video hosted in the wiki? On Thursday, 15 November 2012 02:05:20 UTC-6, Andrew W wrote: Is anyone using video links with auth.wiki ? I'm just getting the bottom bar with the Play button, but nothing else and nothing happens when I press Play. I did have success with plugin_wiki, but I would like to get it up and running with auth.wiki. I've tried with Chrome and Safari. Thanks --
Re: [web2py] Re: Multi-language website with GAE + parameter-based system
Where is this regex? On Thursday, 15 November 2012 13:10:50 UTC-6, David Sorrentino wrote: Hi howesc, Testing the regex I found out the error. Intead of: url: /(?Pa.+?)/static/\w\{2}?/(?Pb.+) it should be: url: /(?Pa.+?)/static/\w{2}?/(?Pb.+) So a backslash was making the difference! :P Thank you very much for your help, now everything works. Cheers, David On 15 November 2012 02:42, howesc how...@umich.edu javascript: wrote: the error is not obvious to me. :( can you verify that your regex matches your URL? On Tuesday, November 13, 2012 6:01:09 AM UTC-8, David Sorrentino wrote: Hi howesc, Thanks for your reply! I tried to set the regex for my needs, but I guess that I am wrong in something. I edited the regex in this way: - url: /(?Pa.+?)/static/\w\{2}?/(?**Pb.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional Now, instead of an error, I get 2 warnings for each static file: WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/en/**css/bootstrap-responsive.min.**css WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/css/**bootstrap-responsive.min.css Any thoughts? Cheers, David On 12 November 2012 23:03, howesc how...@umich.edu wrote: i don't know the full deal with the routerbut it looks like the path to the static files is incorrect (notice the 'en' in the path). you can strip this out in app.yaml (my example strips out a random cache busting param after the 'static/' in the path, you can modify the regex to meet your needs): - url: /(?Pa.+?)/static/.*?/(?Pb.**+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional expiration: 1d cfh On Monday, November 12, 2012 7:19:32 AM UTC-8, David Sorrentino wrote: Hello everybody! :) I am developing a multi-language website deployed on GAE. For my routes.py I would like to use this configuration, shown on the online book (http://web2py.com/books/**defau**lt/chapter/29/04#** Parameter-**based-systemhttp://web2py.com/books/default/chapter/29/04#Parameter-based-system ): routers = dict( BASE = dict(default_application='**myap**p'), myapp = dict(languages=['en', 'it', 'jp'], default_language='en'), ) However, it looks like I am having some troubles with loading the static files. Indeed static files are not loaded and the console shows the following error: [Errno 2] No such file or directory: '/home/dapids/web2py/**applicati* *ons/myapp/en/static/**css/**bootstrap-responsive.min.**css' Am I doing something wrong? Cheers, David -- -- --
[web2py] Re: Importing installed modules
I found the solution is to create a .pth file with the absolute path of the package and put it in the web2py site-packages folder. On Friday, November 16, 2012 12:40:30 PM UTC+11, Massimo Di Pierro wrote: You should not do this: sys.path.append('/home/www/lib/python2.6/M2Crypto-0.21.1-py2.6-linux-i686.egg') It will make the path longer at every http request. If MCryption is pip installed. web2py should just see it. On Wednesday, 14 November 2012 22:28:30 UTC-6, Richard Penman wrote: I installed a module with pip to: /home/www/lib/python2.6/M2Crypto-0.21.1-py2.6-linux-i686.egg When using python directly I can import this module. How should I help web2py find this? For now I have this in my model: import sys sys.path.append('/home/www/lib/python2.6/M2Crypto-0.21.1-py2.6-linux-i686.egg') --
Re: [web2py] Re: Multi-language website with GAE + parameter-based system
it's in app.yaml, so it's GAE specific. On 11/15/12 17:45 , Massimo Di Pierro wrote: Where is this regex? On Thursday, 15 November 2012 13:10:50 UTC-6, David Sorrentino wrote: Hi howesc, Testing the regex I found out the error. Intead of: url: /(?Pa.+?)/static/\w\{2}?/(?Pb.+) it should be: url: /(?Pa.+?)/static/\w{2}?/(?Pb.+) So a backslash was making the difference! :P Thank you very much for your help, now everything works. Cheers, David On 15 November 2012 02:42, howesc how...@umich.edu javascript: wrote: the error is not obvious to me. :( can you verify that your regex matches your URL? On Tuesday, November 13, 2012 6:01:09 AM UTC-8, David Sorrentino wrote: Hi howesc, Thanks for your reply! I tried to set the regex for my needs, but I guess that I am wrong in something. I edited the regex in this way: - url: /(?Pa.+?)/static/\w\{2}?/(?**Pb.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional Now, instead of an error, I get 2 warnings for each static file: WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/en/**css/bootstrap-responsive.min.**css WARNING 2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595] Blocking access to static file /home/dapids/web2py/** applications/myapp/static/css/**bootstrap-responsive.min.css Any thoughts? Cheers, David On 12 November 2012 23:03, howesc how...@umich.edu wrote: i don't know the full deal with the routerbut it looks like the path to the static files is incorrect (notice the 'en' in the path). you can strip this out in app.yaml (my example strips out a random cache busting param after the 'static/' in the path, you can modify the regex to meet your needs): - url: /(?Pa.+?)/static/.*?/(?Pb.**+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional expiration: 1d cfh On Monday, November 12, 2012 7:19:32 AM UTC-8, David Sorrentino wrote: Hello everybody! :) I am developing a multi-language website deployed on GAE. For my routes.py I would like to use this configuration, shown on the online book (http://web2py.com/books/**defau**lt/chapter/29/04#** Parameter-**based-systemhttp://web2py.com/books/default/chapter/29/04#Parameter-based-system ): routers = dict( BASE = dict(default_application='**myap**p'), myapp = dict(languages=['en', 'it', 'jp'], default_language='en'), ) However, it looks like I am having some troubles with loading the static files. Indeed static files are not loaded and the console shows the following error: [Errno 2] No such file or directory: '/home/dapids/web2py/**applicati* *ons/myapp/en/static/**css/**bootstrap-responsive.min.**css' Am I doing something wrong? Cheers, David -- -- --
[web2py] Re: Web2Py and MS Access
Your experience with MS Access will not be good I think. It doesn't even pretend to support SQL standards as far as I remember, and you'll have a very difficult time getting support. The advice to consider the free edition of SQL server is something you should look at. You get nice management tools, and the restrictions of the free version aren't likely to bother you. The performance, robustness, management tools and support is a completely different level than Access. Access is not a server, multi-user access is handled at the OS file level and it's not good. --
[web2py] Re: wxpython app using web2py username and password
I recently devised some changes to globals.py and main.py to allow a non-cookies client to log into web2py and keep the same session record between requests, just as a browser does. In my case the client is a PhoneGap app and I hit web2py through HTTP. I store the web2py session record id on the client in HTML 5 local storage, so that the client can sent it along with each request to tell web2py what session to reconnect to. A similar approach would probably work from a Windows App. On Thursday, November 15, 2012 4:34:22 PM UTC-6, Jim S wrote: My main concern is that with this being a desktop app that I don't want to have to keep the latest versions of those files on the client machines. I switched my desktop authorization to read the Windows username and then match it to a username in the auth_user table and rely on the Windows authentication to ensure that user is logged in properly. I validate that they are on the proper domain and they are logged in with an id in the table. Now I don't need to worry about keep those files current on multiple clients. -Jim On Thursday, November 15, 2012 2:01:12 PM UTC-6, Niphlod wrote: ehm validators.py (if not all, just crypt and lazycrypt, plus Validator original class), utils.py and pbkdf2 is all you need. On Thursday, November 15, 2012 6:32:03 PM UTC+1, Jim S wrote: Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581) --
Re: [web2py] Re: wxpython app using web2py username and password
I would be interested in learning more. do you have any samples you could share? On Nov 15, 2012 8:52 PM, dlypka dly...@gmail.com wrote: I recently devised some changes to globals.py and main.py to allow a non-cookies client to log into web2py and keep the same session record between requests, just as a browser does. In my case the client is a PhoneGap app and I hit web2py through HTTP. I store the web2py session record id on the client in HTML 5 local storage, so that the client can sent it along with each request to tell web2py what session to reconnect to. A similar approach would probably work from a Windows App. On Thursday, November 15, 2012 4:34:22 PM UTC-6, Jim S wrote: My main concern is that with this being a desktop app that I don't want to have to keep the latest versions of those files on the client machines. I switched my desktop authorization to read the Windows username and then match it to a username in the auth_user table and rely on the Windows authentication to ensure that user is logged in properly. I validate that they are on the proper domain and they are logged in with an id in the table. Now I don't need to worry about keep those files current on multiple clients. -Jim On Thursday, November 15, 2012 2:01:12 PM UTC-6, Niphlod wrote: ehm validators.py (if not all, just crypt and lazycrypt, plus Validator original class), utils.py and pbkdf2 is all you need. On Thursday, November 15, 2012 6:32:03 PM UTC+1, Jim S wrote: Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/**web2py/blob/master/gluon/**tools.py#L1776https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/**web2py/blob/master/gluon/**tools.py#L1479https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/**web2py/blob/master/gluon/** validators.py#L2659https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/** web2py/blob/master/gluon/**validators.py#L2581https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581 ) -- --
Re: [web2py] REF: lambda table variable passing error
Thanx man! On Nov 16, 2012 12:13 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: You have to build your own button to redirect on read, create, update if you want this behavior... Not sure what could be the best way to implement that though maybe virtual field should be used to add column to this purpose... Richard On Thu, Nov 15, 2012 at 5:11 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Datatables plugins... But it is not the same and you require to learn it api. The only thing I really miss is the query builder of SQLFORM.grid. With Datatables you have only AND no OR and you can't specify to filter for particular column as far as I know. Richard On Thu, Nov 15, 2012 at 5:02 PM, Teddy Nyambe software@gmail.comwrote: ...so for features like SQLFORM.grid what r u alternatively using? On Nov 15, 2012 10:29 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Off course the id is in the URL. I wasn't know about showid : false... As I wrote I don't know pretty well SQLFORM.grid, I didn't have time to learn it properly and it was changing constantly, so I postpone migration the time the api freezed... :) Richard On Thu, Nov 15, 2012 at 3:10 PM, Niphlod niph...@gmail.com wrote: I meant if you don't want to show the id step1: there's the fields parameter that you can pass to the grid: the id is not shown on the main grid step 2: Don't show it in the edit form. easy-peasy: editargs={'showid' : False} . but the number of the id will be shown no matter what, e.g. in the URL bar when you modify the record, in the tr id= and so on -- -- -- -- --
[web2py] Manually setting email for auth registration form
I have some custom requirements for registration, but I still want to use auth.register() with a custom form view to rely on web2py's form validation. Background: I have a table of allowed email addresses with a generated secret hash. (kind of like an invitation only registration). When you access the secret invite link I look up the secret hash in the database and want to use the auth.register() form without the email field so I can set the user's email to the one I already have. I have come across 2 problems: 1. When my custom form doesn't include an email field, the form does not seem to be processed and just redirects to itself. (see comment in view below) 2. When I set the email field to be not writable, the registration fails and I get a ticket: Traceback (most recent call last): File /Users/flo/Applications/web2py/gluon/restricted.py, line 205, inrestricted exec ccode in environment File /Users/flo/Applications/web2py/applications/main/controllers/signup.pyhttp://127.0.0.1:8000/admin/default/edit/main/controllers/signup.py , line 138, in module File /Users/flo/Applications/web2py/gluon/globals.py, line 173, in lambda self._caller = lambda f: f() File /Users/flo/Applications/web2py/applications/main/controllers/signup.pyhttp://127.0.0.1:8000/admin/default/edit/main/controllers/signup.py , line 62, in complete form = auth.register(onaccept=on_accept) File /Users/flo/Applications/web2py/gluon/tools.py, line 1959, in register user = Storage(table_user._filter_fields(user, id=True)) File /Users/flo/Applications/web2py/gluon/dal.py, line 6683, in_filter_fields return dict([(k, v) for (k, v) in record.items() if k AttributeError: 'NoneType' object has no attribute 'items' Here is the code that I think is relevant for this: Inside my controller: signup_data = db(db.signup.signup_key==signup_key).select(db.signup.ALL).first() def on_accept(form): # does a whole bunch of setting up additional db entries pass # stripped out for the example auth.settings.table_user.email.default = signup_data.email auth.settings.table_user.email.writable = False # causes error form = auth.register(onaccept=on_accept) # line 62 (see error log) Inside my view: {{=form.custom.begin }} div style=display: none; {{ # removing this field from markup causes the form submission to fail. :/}} {{=form.custom.widget.email }} /div {{=form.custom.widget.first_name }} ... all the other widgets ... {{=form.custom.end}} --
[web2py] Re: videos not working in auth.wiki page
No, I was posting a link to a youtube video. On Friday, November 16, 2012 2:41:01 PM UTC+13, Massimo Di Pierro wrote: what video type. Are the video hosted in the wiki? On Thursday, 15 November 2012 02:05:20 UTC-6, Andrew W wrote: Is anyone using video links with auth.wiki ? I'm just getting the bottom bar with the Play button, but nothing else and nothing happens when I press Play. I did have success with plugin_wiki, but I would like to get it up and running with auth.wiki. I've tried with Chrome and Safari. Thanks --
[web2py] Re: videos not working in auth.wiki page
Does the plugin_wiki syntax work in auth.wiki ? (I'll try it tonight). From the book (plugins section): For example, to embed a YouTube video in a plugin_wiki page, you can do `` name: youtube code: l7AWnfFRc7g ``:widget or to embed the same widget in a web2py view, you can do: {{=plugin_wiki.widget('youtube',code='l7AWnfFRc7g')}} --