[web2py] Re: Confused about app

2013-06-25 Thread Niphlod
every app has its own auth system. If you want multiple apps to share the same auth system, look at http://web2py.com/books/default/chapter/29/09#Central-Authentication-Service Il giorno martedì 25 giugno 2013 07:51:08 UTC+2, Tom Russell ha scritto: So I took and modified the welcome app to

[web2py] Re: global python imports

2013-06-25 Thread Massimo Di Pierro
I am surprised this ever worked as you say. The proper thing to do would be to do is to write from ourlib import is_administrator In your models/db.py and it will be visible in all your models that follow db.py alphabetically and all your controllers and views. On Monday, 24 June 2013

Re: [web2py] Re: disable left side panel in editor in 2.5

2013-06-25 Thread paolo.vall...@gmail.com
I see your point, just a question, which web2py version are you using? In trunk there is a newer editor with tabs, it allows you to edit few files in parallel, by removing the left side panel your won't be able to use such feature. Paolo 2013/6/24 lucas sjluk...@gmail.com hard-code or

Re: [web2py] Re: Can page/chapter titles be added to the online book ?

2013-06-25 Thread paolo.vall...@gmail.com
Anthony we can have both, chapter numbers and slug in the url. If we don't change the args position former links should work too. isn't it? Paolo 2013/6/24 Anthony abasta...@gmail.com I have argued for slugs *instead* of chapter numbers in the URL's. There are many links to the book on the

Re: [web2py] Re: Can page/chapter titles be added to the online book ?

2013-06-25 Thread Niphlod
having 01/slug shouldn't be a problem, but those links with /slug will be generated just for the menu part on the left side.I can work on that but I don't see any other place where they can be expressed. On Tuesday, June 25, 2013 9:30:15 AM UTC+2, Paolo valleri wrote: Anthony we can have

Re: [web2py] Re: disable left side panel in editor in 2.5

2013-06-25 Thread Massimo Di Pierro
I do not think we should remove it. We should have a botton collapse it to the left lite a drawer. On Tuesday, 25 June 2013 01:47:01 UTC-5, Paolo valleri wrote: I see your point, just a question, which web2py version are you using? In trunk there is a newer editor with tabs, it allows you to

[web2py] Encrypting/decrypting db values

2013-06-25 Thread lesssugar
I have values I would like to store encrypted in my db after user inserts them. When displayed, the data should get decrypted. All I know about encryption in web2py is that it uses HMAC+SHA512 by default to store password in auth_user table. The algorithm is of course reversible but how do I

[web2py] Re: Someone interested in a simple CMS for web2py? - SimplrCMS

2013-06-25 Thread Loïc
Hi, I don't know if RadiantCMS is still alive. But if you have basic needs (manage pages content and hierarchy) you can have a look to TinyWebsite CMS : www.tinywebsite.net Demo here : http://www.tinywebsite.net/tiny_website_DEMO/ Github repo : https://github.com/espern/tiny_website.git Le

[web2py] Re: Someone interested in a simple CMS for web2py? - SimplrCMS

2013-06-25 Thread loic . espern
Hi, I don't know if RadiantCMS is still alive. But if you have basic needs (manage pages content and hierarchy) you can have a look to TinyWebsite CMS : www.tinywebsite.net Demo here : http://www.tinywebsite.net/tiny_website_DEMO/ Github repo : https://github.com/espern/tiny_website.git Le

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Massimo Di Pierro
You cannot use CRYPT for this purpose. That is a one way hash. The original plaintext cannot be recovered. You need a symmetric cypher. Web2py comes with the gluon/contrib/aes.py from gluon.contrib.aes import AES key = your encryption key IV = ' '*16 db.table.field.filter_in = lambda

[web2py] Re: upgrade your own app

2013-06-25 Thread LightDot
The way you describe the environment, it's impossible to bring deterministic automated updates. If you have users customizing views, css, etc., there is bound to be some manual intervention needed if your updates also include views, css, etc. You could use git, mercurial or a similar tool, but

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread lesssugar
OK, I get it. However, using the code I get: *AttributeError: type object 'AES' has no attribute 'new'* On Tuesday, June 25, 2013 2:00:06 PM UTC+2, Massimo Di Pierro wrote: You cannot use CRYPT for this purpose. That is a one way hash. The original plaintext cannot be recovered. You need a

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Massimo Di Pierro
Sorry. try this: import gluon.contrib.aes as AES key = your encryption key IV = ' '*16 db.table.field.filter_in = lambda data,key=key,iv=IV: AES.new(key,AES.MODE_CBC,iv).encrypt(data) db.table.field.filter_out = lambda data,key=key,iv=IV: AES.new(key,AES.MODE_CBC,iv).decrypt(data) On Tuesday,

[web2py] Heroku Deployment Problems

2013-06-25 Thread Kyle Pennell
I'm trying to deploy a sample application, in this case https://github.com/relsi/web2pyople to Heroku. I was able to get web2py setup on heroku following the instructions Installing your web2py Stack on the Heroku cloud in 4 simple

[web2py] Re: test_has_right_title does not pass in the exercise given in :http://killer-web-development.com/

2013-06-25 Thread shailaja
Thank you so much for responding Danny. Do you mean to say that I need to change the statement :title = self.browser.find_element_by_tag_name('title') to... title = self.browser.title ...?? On Monday, June 24, 2013 12:12:20 PM UTC+5:30, shai...@signumsol.com wrote: In the tukker

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread lesssugar
It rises an exception now: I believe it's this part of aes: if len(data) % self.block_size != 0: raise ValueError, Input length must be multiple of 16 On Tuesday, June 25, 2013 2:27:11 PM UTC+2, Massimo Di Pierro wrote: Sorry. try this: import gluon.contrib.aes as AES key = your

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread lesssugar
It rises an exception now: *ValueError: Plaintext length must be multiple of 16* I believe it's this part of aes: if len(data) % self.block_size != 0: raise ValueError, Input length must be multiple of 16 Not sure what's wrong. On Tuesday, June 25, 2013 2:27:11 PM UTC+2, Massimo Di

Re: [web2py] compute try to understand something

2013-06-25 Thread Richard Vézina
I will try to pack a little app... Richard On Fri, Jun 21, 2013 at 4:40 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It should. Can you provide a concrete example? On Friday, 21 June 2013 10:31:45 UTC-5, Richard wrote: Further code review lead me to the conclusion that the

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Massimo Di Pierro
One more try: import gluon.contrib.aes as AES key = your encryption key IV = ' '*16 db.table.field.filter_in = lambda data,key=key,iv=IV: AES.new(key,AES.MODE_CBC,iv).encrypt(AES.pad(data)) db.table.field.filter_out = lambda data,key=key,iv=IV: AES.new(key,AES.MODE_CBC,iv).decrypt(data) the

[web2py] How to import a third party module

2013-06-25 Thread peibol
Hi there: I know there are some threads about this issue but I don't get the thing. It's supposed that if I put the module into the /myapp/modules subfolder, importing as usual in Python should work (eg, import mymodule or from mymodule import *). I'm trying to use sympy in my app. When I

[web2py] Re: feeding python string object to d3.js csv

2013-06-25 Thread greaneym
Thanks for the answers Anthony, I am going to try to report a bug. I am using web2py 2.4.6-stable+timestamp.2013.04.06.17.37.38 the source version, on mac os and when I copy and paste the csv as a service example from the book section on Remote procedure calls, to the default.py in the

Re: [web2py] Re: Confused about app

2013-06-25 Thread Tom Russell
Well agreed, but I set that up in the welcome app so it would seem like that should move over to my other app as well? On Tue, Jun 25, 2013 at 2:24 AM, Niphlod niph...@gmail.com wrote: every app has its own auth system. If you want multiple apps to share the same auth system, look at

[web2py] Re: feeding python string object to d3.js csv

2013-06-25 Thread Anthony
Not a bug. I think @service.csv sets the content-type of the response to 'text/x-csv', so that will likely prompt the browser to do a download rather than display the text (which is typically what is desired). Have you tried it with D3 to see if it works as is? Anthony On Tuesday, June 25,

[web2py] Multi Table Form

2013-06-25 Thread Tom Russell
I have the following form that uses 3 different tables and when I submit the data it all seems to submit correctly but when I view the data in a smart grid with linked tables in the columns clicking on the link does not show any record for the row of linked data. My smartgrid code: def

Re: [web2py] Re: Confused about app

2013-06-25 Thread Anthony
On Tuesday, June 25, 2013 10:12:32 AM UTC-4, Tom Russell wrote: Well agreed, but I set that up in the welcome app so it would seem like that should move over to my other app as well? Are you saying you customized the welcome app and then used admin to create a new app? In that case, note

[web2py] Re: test_has_right_title does not pass in the exercise given in :http://killer-web-development.com/

2013-06-25 Thread dhmorgan
you're welcome; I'd been wanting to run through the tutorial, yes,within test_static_pages.py (though I guess you've probably tried it by now) it will work that way; I don't know selenium well enough to say whether his example should work or whether browser.title is the preferred way; I'd

Re: [web2py] Re: Confused about app

2013-06-25 Thread Tom Russell
Yes I customized welcome and then added a new app via the admin interface. I did not directly copy the welcome app, just modified the html etc. Now I am really confused about how this all works. So when I fire up web2py and create a new app via the admin, should that be my only app then? So I

Re: [web2py] Re: Confused about app

2013-06-25 Thread Tom Russell
But I do like this: ## create all tables needed by auth if not custom tables auth.define_tables(username=True, signature=True) I was using auth.signature for each table but that gave me an error after setting the CAS stuff. Once commented out it works fine. I was getting a 'DAL' object has no

Re: [web2py] Re: Confused about app

2013-06-25 Thread Anthony
On Tuesday, June 25, 2013 11:04:22 AM UTC-4, Tom Russell wrote: Yes I customized welcome and then added a new app via the admin interface. I did not directly copy the welcome app, just modified the html etc. Now I am really confused about how this all works. So when I fire up web2py and

[web2py] Smartgrid Links

2013-06-25 Thread Tom Russell
I have a smartgrid with a link like so: links = [lambda row: A(T('Create Appointment'),_href=URL(AppointmentManager,appointment_create,args=[ row.id]))] grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, create=True, maxtextlength=64, paginate=25, links=links,

[web2py] make a fake request from URL(...)

2013-06-25 Thread Richard
Hello, How can I make a fake request in order I can retrieve my table name in request.args(0) like my app does... Thanks Richard -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread lesssugar
Hmm, as for AES(pad(data)): *'module' object has no attribute 'pad'* * * In addition, can't find any reference of what pad() is in Python. On Tuesday, June 25, 2013 3:58:59 PM UTC+2, Massimo Di Pierro wrote: One more try: import gluon.contrib.aes as AES key = your encryption key IV = '

Re: [web2py] Re: Confused about app

2013-06-25 Thread Tom Russell
Ah, I forgot to add the following line to my consumer app: auth = Auth(db,cas_provider = ' http://127.0.0.1:8000/welcome/default/user/cas') On Tue, Jun 25, 2013 at 10:12 AM, Tom Russell t...@caregointl.com wrote: Well agreed, but I set that up in the welcome app so it would seem like that

Re: [web2py] make a fake request from URL(...)

2013-06-25 Thread Anthony
Not quite clear what you mean. How does your app get a table name in request.args(0)? On Tuesday, June 25, 2013 12:07:48 PM UTC-4, Richard wrote: Hello, How can I make a fake request in order I can retrieve my table name in request.args(0) like my app does... Thanks Richard -- ---

[web2py] Re: Smartgrid Links

2013-06-25 Thread Anthony
If you only provide two positional args to URL, it assumes they are the controller and function. In this case, you'll need to specify the application, controller, and function: URL(AppointmentManager, yourcontroller, appointment_create, args=[row. id]) You can also used keyword arguments a, c,

Re: [web2py] make a fake request from URL(...)

2013-06-25 Thread Richard Vézina
Here an example of URL : URL(c='my_controller', f='my_func', args=('my_table', 'record_id')) I would like to know how I can create a fake request object from an URL() or other mean... Hope it is clearer. Thanks Richard On Tue, Jun 25, 2013 at 1:28 PM, Anthony abasta...@gmail.com wrote: Not

Re: [web2py] Re: Smartgrid Links

2013-06-25 Thread Tom Russell
Ah I see now, Thanks. On Tue, Jun 25, 2013 at 1:31 PM, Anthony abasta...@gmail.com wrote: If you only provide two positional args to URL, it assumes they are the controller and function. In this case, you'll need to specify the application, controller, and function: URL(AppointmentManager,

Re: [web2py] make a fake request from URL(...)

2013-06-25 Thread Anthony
Do you mean you want a gluon.globals.Request object with its application, controller, function, and args values set as per your URL? WAYRTTD? On Tuesday, June 25, 2013 1:34:43 PM UTC-4, Richard wrote: Here an example of URL : URL(c='my_controller', f='my_func', args=('my_table',

Re: [web2py] make a fake request from URL(...)

2013-06-25 Thread Richard Vézina
I think yes, I have an function used in a compute field and I am trying to understand why it not compute in certain situation... In my function I request for request.args(0) as default argument. So I want to kind of mock web2py request object. Richard On Tue, Jun 25, 2013 at 1:40 PM, Anthony

[web2py] How to remove test user's registration

2013-06-25 Thread Ian W. Scott
Hi again, I'm working on returning my test db to its initial state after I run my unit/integration tests. I'm registering a test user just fine using the fantastic WebClient. But how can I remove that test user afterwards? (Otherwise I'll end up with my test db cluttered with redundant test

[web2py] Re: How to remove test user's registration

2013-06-25 Thread Anthony
.delete() http://web2py.com/books/default/chapter/29/06#count,-isempty,-delete,-update On Tuesday, June 25, 2013 1:57:23 PM UTC-4, Ian W. Scott wrote: Hi again, I'm working on returning my test db to its initial state after I run my unit/integration tests. I'm registering a test user just

Re: [web2py] make a fake request from URL(...)

2013-06-25 Thread Anthony
You can manipulate the request object in your code: request.args.insert(0, 'somevalue') Anthony On Tuesday, June 25, 2013 1:48:08 PM UTC-4, Richard wrote: I think yes, I have an function used in a compute field and I am trying to understand why it not compute in certain situation... In my

Re: [web2py] make a fake request from URL(...)

2013-06-25 Thread Richard Vézina
Great, that what I want. Thanks Richard On Tue, Jun 25, 2013 at 2:10 PM, Anthony abasta...@gmail.com wrote: You can manipulate the request object in your code: request.args.insert(0, 'somevalue') Anthony On Tuesday, June 25, 2013 1:48:08 PM UTC-4, Richard wrote: I think yes, I have

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Niphlod
actually, it's not that easy. I gave up on lambdas for this implementation, but it works out nicely import gluon.contrib.aes as AES import threading import base64 import os def w2p_encrypt(data): key = 'asdsaddasdasdas' key = pad(key[:32]) cipher, IV = AES_new(key)

[web2py] Re: How to remove test user's registration

2013-06-25 Thread Ian W. Scott
Ok, thanks Anthony. So what you're saying is that there's no auth method or anything parallel to user/register. You just remove the db.auth row directly. That's simple enough. Ian On Tuesday, June 25, 2013 1:57:23 PM UTC-4, Ian W. Scott wrote: Hi again, I'm working on returning my test db

[web2py] Re: How to remove test user's registration

2013-06-25 Thread Niphlod
yep. PS: in addition you rarely may want to have the db where your tests happen to be the same as the one you use in production On Tuesday, June 25, 2013 8:38:03 PM UTC+2, Ian W. Scott wrote: Ok, thanks Anthony. So what you're saying is that there's no auth method or anything parallel

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Niphlod
sorry, cutpaste error. import gluon.contrib.aes as AES import threading import os import base64 def fast_urandom16(urandom=[], locker=threading.RLock()): this is 4x faster than calling os.urandom(16) and prevents the too many files open issue with concurrent access to

[web2py] Flat text files as data source for web2py

2013-06-25 Thread Ian W. Scott
I'm attracted to the spate of recent flat-file blogging platforms, using plain text (markdown) files to store the blog posts. I especially like the idea of using dropbox or a git repo to store the files. Has anyone experimented with this in web2py? I can imagine at least two ways of doing it:

[web2py] response.files.append in component plugin

2013-06-25 Thread RHC
I am trying to create a component plugin. I would like to add in some javascript and css files from the plugin with as little editing as possible. I have a view.load file as part of the plugin and I tried to add something like this to the top of this view file: {{

[web2py] Re: feeding python string object to d3.js csv

2013-06-25 Thread Andrew W
Suggest you look at the book section rendering a dictionary, I use the json approach with d3, and then reference the URL in the js script. Works great and should work for csv too. This approach allows you to get the file formatted in the way d3 expects it, without trying to do it in js code.

[web2py] Re: feeding python string object to d3.js csv

2013-06-25 Thread Anthony
I would guess D3 would be faster if fed JSON (which is already Javascript) rather than having to first parse CSV. Anthony On Tuesday, June 25, 2013 3:59:48 PM UTC-4, Andrew W wrote: Suggest you look at the book section rendering a dictionary, I use the json approach with d3, and then

[web2py] Re: response.files.append in component plugin

2013-06-25 Thread Niphlod
response.files gets only called inside web2py_ajax.html, that is evaluated only when you load the layout.html in HTML, all static assets must be in the head to be sure all are loaded when you try to execute some code. If you need to include a js file and you're sure all the dependencies are

[web2py] Re: response.files.append in component plugin

2013-06-25 Thread Anthony
The problem is that response.files are inserted in the head of the layout, but components are loaded via ajax after the main page has been loaded, so your code will have no effect. You could call response.include_files() after appending the files -- that will insert the relevant code right

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Massimo Di Pierro
Should we include decrypt(key,data) and encrypt(key,data) in gluon.utils? On Tuesday, 25 June 2013 13:42:29 UTC-5, Niphlod wrote: sorry, cutpaste error. import gluon.contrib.aes as AES import threading import os import base64 def fast_urandom16(urandom=[], locker=threading.RLock()):

[web2py] Re: Flat text files as data source for web2py

2013-06-25 Thread Niphlod
if you want to reinvent the wheel you can play with that, but the spate (as you describe that) is actually something that serialize into STATIC webpages a somewhat fixed structure of flat files, on a given command. I actually did it for the diffbook, http://niphlod.github.io/diffbook/, to use

[web2py] Re: GAE Database codification issues? Using reveal-slides and wiki pages

2013-06-25 Thread peibol
Excuse me for the monologue, but it can also be useful for somebody. The thing was that I was accesing the deployed app via https. Doing so, chrome disabled js, and the weird thing is that in Firefox it works. Anyway, accessing via usual http does the trick. El lunes, 24 de junio de 2013

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Derek
Only if there is an optional algorithm argument. On Tuesday, June 25, 2013 1:23:32 PM UTC-7, Massimo Di Pierro wrote: Should we include decrypt(key,data) and encrypt(key,data) in gluon.utils? On Tuesday, 25 June 2013 13:42:29 UTC-5, Niphlod wrote: sorry, cutpaste error. import

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Niphlod
because you want something else from AES ? On Tuesday, June 25, 2013 10:31:47 PM UTC+2, Derek wrote: Only if there is an optional algorithm argument. On Tuesday, June 25, 2013 1:23:32 PM UTC-7, Massimo Di Pierro wrote: Should we include decrypt(key,data) and encrypt(key,data) in

[web2py] Re: How to import a third party module

2013-06-25 Thread peibol
Could it be a bug? If I put it under site-packages and run locally, it works. When running in GAE, fails. If I put it under the modules folder (where I want to put it), it fails both in local and in GAE. El martes, 25 de junio de 2013 16:00:25 UTC+2, peibol escribió: Hi there: I know

[web2py] Re: response.files.append in component plugin

2013-06-25 Thread RHC
Niphlod, Thanks, I wasn't aware of these other ways to append these files. That's certainly useful to know. Richard. On Tuesday, June 25, 2013 9:16:35 PM UTC+1, Niphlod wrote: response.files gets only called inside web2py_ajax.html, that is evaluated only when you load the layout.html

[web2py] Re: Encrypting/decrypting db values

2013-06-25 Thread Derek
Something other than AES, yes. Perhaps ECE (elliptic curve encryption) or something other than AES. Shouldn't I have a choice? On Tuesday, June 25, 2013 1:36:56 PM UTC-7, Niphlod wrote: because you want something else from AES ? On Tuesday, June 25, 2013 10:31:47 PM UTC+2, Derek wrote:

[web2py] Re: feeding python string object to d3.js csv

2013-06-25 Thread greaneym
Anthony, I look forward to your incorporation of d3 into web2py! Maybe you have enough d3 knowledge to help me make this work. in my controller, powertoday.py there is a function, def csvtab(): #return dict(rows = db(db.ptoday.id0).select( )) rows = db(db.ptoday.id0).select( ) for

[web2py] Re: feeding python string object to d3.js csv

2013-06-25 Thread Anthony
I've tried many, many things (I want to get the csv as python solution working), including this, g = new Dygraph( document.getElementById(div_pt), d3.csv({{=URL('powertoday','cvstab.csv')}}), Your URL needs to be in quotes: d3.csv({{=URL('powertoday','cvstab.csv')}})

[web2py] Understanding Checkboxes widget

2013-06-25 Thread greenpoise
I want to do this: db.define_table('finish', Field('name'), Field('abbr')) db.finish.name.requires = IS_NOT_IN_DB(db,db.finish.name) db.finish.abbr.requires = IS_NOT_IN_DB(db,db.finish.abbr) db.define_table('product', Field('series', 'reference series'), Field('material',

[web2py] Re: Understanding Checkboxes widget

2013-06-25 Thread Anthony
In the last 2 lines it looks like you're adding requires attributes to tables rather than fields (and the table name in the first of those lines doesn't match the name of the previously defined table). Anthony On Tuesday, June 25, 2013 7:43:12 PM UTC-4, greenpoise wrote: I want to do this:

[web2py] Accessing values from additional field in sqlform.grid for all rows- Help Needed

2013-06-25 Thread PremKumar KrishnaKumar
Hi, I am new to Web2Py and would like to achieve 'selectable' like functionality through links but I am not sure how to pass the ID and flag from checkbox to the controller function *Why links why not selectable?* I might need multiple columns with checkbox and links is the easiest

[web2py] Adding custom operators to DAL

2013-06-25 Thread Calvin
I think it would be nice to specify custom operators that can be used with the DAL as I believe this would allow for operators that are currently yet to be supported with a built-in DAL operator... From dal.py, I am thinking this should be relatively easy to implement, and code would be along

[web2py] SQLFORM.smartgrid

2013-06-25 Thread Tom Russell
Another question on the smartgrid. I have linked tables in my smartgrid like: grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, create=False, maxtextlength=64, paginate=25, links=links, links_in_grid=True, linked_tables=['emergencycontacts','dependents']) When clicking on