[web2py] Re: Include another file, but do not process it

2015-02-16 Thread Daniel Gonzalez
lder, 'views', view_path), > 'rb').read(), >escape=False) > > In the view: > > {{include_hbs('dashboard.hbs')}} > > You might also add an option to cache in RAM for some period of time. > > Anthony > > On Saturday, Fe

[web2py] Include another file, but do not process it

2015-02-14 Thread Daniel Gonzalez
Hi, This is my use case: I have some web2py templates which are serving some views with embedded handlebar templates, which are intended for processing on the client side: they must arrive untouched to the browser. The problem is that handlebars and web2py have by default the same delimiters: {

[web2py] Re: define_table does not create table in database

2014-10-30 Thread Daniel Gonzalez
: make sure that a single db object is used in the models and in any external modules. Thanks for your assistance! Daniel Gonzalez On Thursday, October 30, 2014 4:29:26 PM UTC+1, Daniel Gonzalez wrote: > > Getting closer to identifying my problem. It seems I am having several > problem

[web2py] Re: define_table does not create table in database

2014-10-30 Thread Daniel Gonzalez
Getting closer to identifying my problem. It seems I am having several problems at once. First, it seems that migrate_enabled=False prevents not only migrations, but also table creation (am I right here?) Second: while trying to guess the problems with my application, I am using the test scr

[web2py] Re: define_table does not create table in database

2014-10-30 Thread Daniel Gonzalez
One more thing: you mention tables are lazy, but the documentation says they are lazy only whenever DAL(...,lazy_tables=True) is set (DAL documentation ) Which one is right? -- Resources: - http

[web2py] Re: define_table does not create table in database

2014-10-30 Thread Daniel Gonzalez
Thanks for your reply, Migrate is not the problem: it does not matter if I do migrate_enabled=False or migrate_enabled=True. Besides, there is no table to migrate. That is the whole problem: define_table does not create the table! I am doing my own define_table because I have need to trigger so

[web2py] define_table does not create table in database

2014-10-30 Thread Daniel Gonzalez
I am running `define_tables` in the recommended way: db = DAL('postgres://user:@localhost:5432/mydb', migrate_enabled=False, auto_import=False, lazy_tables=True) db.define_table('auth_user', Field('email', unique=True), Field('password', length=512, type='password', re

Re: [web2py] Re: Proposal: create "namespaces" for translation system

2013-09-23 Thread Daniel Gonzalez Zaballos
The idea is exactly for this. To have separated localized components. I hope that in a few weeks/months we can release something that we are working on components. I cannot say to much now :) 2013/9/23 Massimo Di Pierro > I was skeptical but I have been convinced this is an excellent idea. Your

Re: [web2py] Re: Proposal: create "namespaces" for translation system

2013-09-02 Thread Daniel Gonzalez Zaballos
Hello Massimo, We'll try to have it at the end of the month. We had applied it to production and is a 1.99.7 version and the trunk version has changed a lot. One question, what do you mean with use "." instead of "app_name"? Regards 2013/9/1 Massimo Di Pierro > Hello Demetrio, > > sorry for

[web2py] Catch-all function in controller

2013-06-26 Thread Daniel Gonzalez
Hi, I have an api.py module which is the interface to my restful api. Currently I have to do the following to extend my api: def common(obj): response.view = 'generic.json' response.headers['Content-Type'] = CONTENT_TYPE_JSON def GET(*args,**vars): return api_router(API_GET

[web2py] Re: URL for static assets produces wrong value?

2013-05-30 Thread Daniel Gonzalez
app2/\g'), ) routes_out = ( ('/admin(?P.*)', '\g'), ('/app1(?P.*)', '\g'), ('/app2/(?P.*)', '/\g'), ) And that works. Sorry again. On Thursday, May 30, 2013 8:12:26 PM UTC+2, Daniel Gonzalez wrote:

[web2py] URL for static assets produces wrong value?

2013-05-30 Thread Daniel Gonzalez
Hi, I have a strange use case, which is maybe not covered by the router / URL implementation. I have just started using a second application, and I have modified my routes.py: routes_in = ( ('/admin(?P.*)', '/admin\g'), ('/app1(?P.*)','/app1\g'), ('/(?P.*)',

[web2py] Missing ASIDE tag in web2py gluon

2013-05-29 Thread Daniel Gonzalez
The ASIDE helper (HTML5) is missing in gluon (using web2py 2.7.4). Useful to do something like this: http://purecss.io/layouts/gallery/ I have defined it in terms of DIV: class ASIDE(DIV): tag = 'aside' And works for me. I am not sure if gluo

[web2py] Re: Strategies to select the preferred language

2013-05-29 Thread Daniel Gonzalez
And a final question: since I will only be supporting a handful of languages (english, german and italian) I would like to set the current languages. I have found T.set_current_languages. Is this the right function to set the supported languages? Is there an example somewhere on how to use this

[web2py] Re: Strategies to select the preferred language

2013-05-29 Thread Daniel Gonzalez
ion is performed. On Wednesday, May 29, 2013 9:06:56 AM UTC+2, Niphlod wrote: > > ? never had issues with users usually they download the browser with > the language they're in. > BTW, forcing a language using a session variable is not hard at all in > web2py. >

[web2py] Strategies to select the preferred language

2013-05-29 Thread Daniel Gonzalez
Hi, According to the documentation, the T operator works based on the Accept-Language setting. In my experience, this is quite cumbersome for a user to set-up (I have not even succeeded in setting th

[web2py] Re: Support for internationalization in web2py wiki

2013-05-28 Thread Daniel Gonzalez
d recommended using different > pages for different languages. In your opinion, how should > internationalization for wiki pages work? > > On Tuesday, 28 May 2013 14:35:21 UTC-5, Daniel Gonzalez wrote: >> >> Hi, >> >> I have started to use the web2py wiki module, bu

[web2py] Support for internationalization in web2py wiki

2013-05-28 Thread Daniel Gonzalez
Hi, I have started to use the web2py wiki module, but can not find any support for internationalization of the wiki pages. What I would like is to be able to select the language based on some query parameters or some configuration parameters. Of course, the pages must be already be saved in the

[web2py] Create URL with embedded json object

2013-05-17 Thread Daniel Gonzalez
Hi, In one of my views I am creating a table. During table creation time I have some dictionaries that I want to return as json objects. So in column "data" I want to provide a link to download this json objects. These objects are not stored anywhere (they are dinamically created), and are thu

[web2py] Handling OPTIONS request in a web2py RESTful API

2013-05-10 Thread Daniel Gonzalez
Hi, I have implemented a RESTful api in web2py which handle the usual GET, POST, PUT, DELETE. (using @request.restful()) Is there a standard mechanism in web2py to implement OPTIONS requests? Thanks, Daniel -- --- You received this message because you are subscribed to the Google Groups "we

Re: [web2py] Re: track_changes bug or feature?

2013-04-08 Thread Daniel Gonzalez Zaballos
Thanks! I said it because restarting the server with every little change in a development environment, is a little weird. I'll change some imports to make them inside methods. 2013/4/6 Massimo Di Pierro > This is intended. classone is importend once and it imports classtwo. This > happens only

[web2py] Re: Access data in PUT request for @request.restful()

2013-04-03 Thread Daniel Gonzalez
l part parses the data as web2py does, so accepts form/* encoded > parameters... it doesn't parse json in the body. > > On Wednesday, April 3, 2013 8:19:04 AM UTC+2, Daniel Gonzalez wrote: >> >> Sorry to come back to this after two weeks (was busy with other stuff

[web2py] Re: Access data in PUT request for @request.restful()

2013-04-02 Thread Daniel Gonzalez
equest.restful() doing that automatically? (I can not see it in the code). Thanks, Daniel On Friday, March 22, 2013 6:02:32 AM UTC+1, Massimo Di Pierro wrote: > > if request.env.request_method=='POST': > put_vars = request.post_vars > > basically request.post_vars ar

[web2py] Re: Access data in PUT request for @request.restful()

2013-03-22 Thread Daniel Gonzalez
3 6:02:32 AM UTC+1, Massimo Di Pierro wrote: > > if request.env.request_method=='POST': > put_vars = request.post_vars > > basically request.post_vars are the variables in body whether it is PUT > or POST or other. > > > > On Thursday, 21 March 2013 1

[web2py] Access data in PUT request for @request.restful()

2013-03-21 Thread Daniel Gonzalez
Hi, How can I access the data in the PUT request? (in the body of the request) Can this be automatically parsed (my data is JSON) Thanks, Daniel -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop rece

[web2py] Re: Slow DAL initialization

2013-03-14 Thread Daniel Gonzalez
ike an improvement. On Thursday, March 14, 2013 2:13:51 PM UTC+1, Niphlod wrote: > > pool ? > > On Thursday, March 14, 2013 1:16:25 PM UTC+1, Daniel Gonzalez wrote: >> >> This codes in the model takes between 5ms and 24ms to complete: >> >> WEB2PY_DAL_STORAGE="post

Re: [web2py] Re: Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
Thanks Jonathan, that makes sense. On Thursday, March 14, 2013 1:54:35 PM UTC+1, Jonathan Lundell wrote: > > On 14 Mar 2013, at 4:45 AM, Daniel Gonzalez > > wrote: > > Thanks Niphlod, I am making progress thanks to your suggestions. > > > > I have a strange

[web2py] Slow DAL initialization

2013-03-14 Thread Daniel Gonzalez
This codes in the model takes between 5ms and 24ms to complete: WEB2PY_DAL_STORAGE="postgres://myuser:mypass@localhost:5432/mydb" db = DAL(WEB2PY_DAL_STORAGE, migrate_enabled=False, lazy_tables=True) I am in a laptop with: - 2 cores, 3300 bogomips/core - 4 GB - linux 2.6.32-5-686 Is th

[web2py] Re: Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
(Strange, your reply arrives per email but is not visible in the google groups thread. I quote) it **should** not happen if you see the code. > https://github.com/web2py/web2py/blob/master/gluon/main.py#L566 > https://github.com/web2py/web2py/blob/master/gluon/dal.py#L555 > are you sure that

[web2py] Re: Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
de your function. > > On Thursday, March 14, 2013 11:59:26 AM UTC+1, Daniel Gonzalez wrote: >> >> But this has two drawbacks: >> >>- the decorator must be added to every controller function >>- it gets executed before rendering the template. >> >&

[web2py] Re: Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
But this has two drawbacks: - the decorator must be added to every controller function - it gets executed before rendering the template. On Thursday, March 14, 2013 11:56:53 AM UTC+1, Daniel Gonzalez wrote: > > Are you suggesting something like this (which is what I am currently &

[web2py] Re: Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
do "after callback" is fine if executed > asynchronously, you can set up a queue of things to do to be processed > afterwards. > > PS2: to kick in after the rendering you must return the compiled template, > e.g. > result = response.render(...) > ...some lengthy &q

[web2py] Re: Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
And (I am discovering some effects during testing): 4. Is it possible to call this function *after* the templates have been rendered? On Thursday, March 14, 2013 11:09:51 AM UTC+1, Daniel Gonzalez wrote: > > And: > > 3. Is it possible to call this function also for jsonrpc requ

[web2py] Re: Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
And: 3. Is it possible to call this function also for jsonrpc requests? On Thursday, March 14, 2013 11:00:13 AM UTC+1, Daniel Gonzalez wrote: > > Hi, > > For some tests that I am performing, I would like to call a function > "request_processed()" (defined in a model, fo

[web2py] Call a function at the end of every request

2013-03-14 Thread Daniel Gonzalez
Hi, For some tests that I am performing, I would like to call a function "request_processed()" (defined in a model, for example), at the end of every request. 1. Is this possible? How? 2. Is it possible to also call this function in case no controller was found to serve the request? Thanks, D

[web2py] Re: Strange problem importing a module

2013-03-07 Thread Daniel Gonzalez
doing: from top_namespace.my_module import my_funcion And the issues are gone. I suspect one of my libraries was conflicting with one the modules provided by web2py, but have no prove of that. On Wednesday, March 6, 2013 7:53:26 PM UTC+1, Daniel Gonzalez wrote: > > Currently running Version

[web2py] Re: Strange problem importing a module

2013-03-06 Thread Daniel Gonzalez
information I'll post it. Otherwise I'll move to 2.4.2 and see if that solves the problems. On Wednesday, March 6, 2013 7:41:23 PM UTC+1, Massimo Di Pierro wrote: > > Which web2py version? Some changes were made to 2.4.2 to the custom > importer. > > On Wednesday, 6 March 20

[web2py] Strange problem importing a module

2013-03-06 Thread Daniel Gonzalez
Hi, I have this very strange issue: I am importing a module in the web2py models, but the module can not be found. This is only happening in one of my production hosts: the rest are ok (very similar machines, similar setup). If I import the module from a python shell, it works, but importing fro

[web2py] Querying the DAL by regex

2013-01-22 Thread Daniel Gonzalez
Hi, I have this function to delete a user with a certain email address: def delete_user(self, email): my_query = self.db[self.web2py_user_table].email == email my_set = self.db(my_query) my_set.delete() Now I would like to implement a function to delete several user

[web2py] Specify my own controller for @auth.requires_login()

2013-01-18 Thread Daniel Gonzalez
Hi, Whenever my login expires, web2py redirects to application/default/user/login?_next=. Since I have a customized login controller, I would like to redirect to it whenever the login expires. Is it possible to "configure" @auth.requires_login() to point to my own controller? Thanks, Daniel -

[web2py] Re: Triggering imports during web2py startup

2013-01-17 Thread Daniel Gonzalez
s I start at least N parallel >> requests, N being the number of processes ... >> >> On Wednesday, January 16, 2013 5:37:24 PM UTC+1, Niphlod wrote: >>> >>> do an "outside" request as soon as you reload apache with curl ? >>> >>> I

[web2py] Re: Problems with auth.login_bare when using postgres

2013-01-17 Thread Daniel Gonzalez
l(pg_get_serial_sequence('auth_cas', 'id'), (select max( id) from auth_cas) ); On Thursday, January 17, 2013 8:52:03 PM UTC+1, Niphlod wrote: > > yep, probably exporting all to csv and reimporting would have you saved a > bit of hassle. > > On Wednesd

[web2py] Re: Why does the login expire when doing periodic jsonrpc requests?

2013-01-17 Thread Daniel Gonzalez
Here: http://code.google.com/p/web2py/issues/detail?id=1287 On Thursday, January 17, 2013 4:50:08 AM UTC+1, Massimo Di Pierro wrote: > > Please open a ticket about this... :-) > > On Wednesday, 16 January 2013 17:28:59 UTC-6, Daniel Gonzalez wrote: >> >> This is the

[web2py] Re: Possible bug? session.auth is None in some requests

2013-01-17 Thread Daniel Gonzalez
wrote: > > You're sure the client is sending the session cookie each time? > > On Wednesday, January 16, 2013 10:19:01 PM UTC-5, Daniel Gonzalez wrote: >> >> Hi, >> >> I am doing stress testing of my web2py application. The way I am doing >> this is: >

[web2py] Re: Possible bug? session.auth is None in some requests

2013-01-17 Thread Daniel Gonzalez
January 17, 2013 4:56:00 AM UTC+1, Massimo Di Pierro wrote: > > You are modifying Auth code. What problem are you trying to solve? > Sessions and session.auth work well with both stable and trunk version, do > they not? > > On Wednesday, 16 January 2013 21:19:01 UTC-6, Daniel Gonza

[web2py] Why does the login expire when doing periodic jsonrpc requests?

2013-01-16 Thread Daniel Gonzalez
This is the relevant section in Auth.__init__ for the login expiration: if auth and auth.last_visit and auth.last_visit + \ datetime.timedelta(days=0, seconds=auth.expiration) >request .now: self.user = auth.user # this is a trick to speed up session

[web2py] Re: Moving away from the "default" controller

2013-01-16 Thread Daniel Gonzalez
Have you modified the routes.py file? On Wednesday, January 16, 2013 11:39:55 PM UTC+1, GeeksRule wrote: > > I think I'm doing something silly. For the first time now I'm moving away > from the "default" controller. > I've created a new controller called "fromuser.py", there is a single > functi

[web2py] Re: What is the timeout for the session?

2013-01-16 Thread Daniel Gonzalez
Added: http://code.google.com/p/web2py/issues/detail?id=1285 On Wednesday, January 16, 2013 9:24:19 PM UTC+1, Anthony wrote: > > The open issue is still expiration of the data in memcache, in combination >> with the auth.settings.expiration. I think this is not well integrated: if >> the memcach

[web2py] Re: What is the timeout for the session?

2013-01-16 Thread Daniel Gonzalez
> a session cookie? If not, then those calls would not affect the session or > the Auth login expiration. > > Anthony > > On Tuesday, January 15, 2013 8:27:04 AM UTC-5, Daniel Gonzalez wrote: >> >> FYI: >> >> Regarding my last two questions: the

[web2py] Re: Triggering imports during web2py startup

2013-01-16 Thread Daniel Gonzalez
wrote: > > do an "outside" request as soon as you reload apache with curl ? > > Il giorno mercoledì 16 gennaio 2013 12:06:14 UTC+1, Daniel Gonzalez ha > scritto: >> >> Hi, >> >> In my models I am importing third party libraries. Importing those &

[web2py] Re: Problems with auth.login_bare when using postgres

2013-01-16 Thread Daniel Gonzalez
Be careful with this, since it will drop and recreate the database. Also, the changes to the sqlite dump are very specific to my situation. YMMV. On Wednesday, January 16, 2013 4:06:23 PM UTC+1, Daniel Gonzalez wrote: > > Hi, > > The following code was working when using SQLi

[web2py] Problems with auth.login_bare when using postgres

2013-01-16 Thread Daniel Gonzalez
Hi, The following code was working when using SQLite, and now that I have moved to postgres it is failing: auth.login_bare(request.vars.email, request.vars.password) I have the passwords for the time being in plaintext, both in postgres and SQLite. I have imported the data to postgres like thi

[web2py] Triggering imports during web2py startup

2013-01-16 Thread Daniel Gonzalez
Hi, In my models I am importing third party libraries. Importing those libraries takes time (3s) which means the first requests (one per process) take long time to be served. Do you have any suggestion on how to trigger the importing before the first requests arrive? I am running web2py via ap

[web2py] Re: What is the timeout for the session?

2013-01-15 Thread Daniel Gonzalez
*inactivity* (meaning, no requests at all) period longer than auth.settings.expiration has passed, the session should expire. Is this how things should work with the current implementation? On Tuesday, January 15, 2013 1:26:48 PM UTC+1, Daniel Gonzalez wrote: > > And even worse: I am setting, for t

Re: [web2py] Re: Fatal Python error: Couldn't create autoTLSkey mapping

2013-01-15 Thread Daniel Gonzalez
I have not yet upgraded :( On Tuesday, January 15, 2013 1:25:06 PM UTC+1, Richard Penman wrote: > > Already 2.7.3. > > Did you find the problem fixed after upgrading? > > > On Tue, Jan 15, 2013 at 11:22 PM, Daniel Gonzalez > > > wrote: > > The links I s

[web2py] Re: What is the timeout for the session?

2013-01-15 Thread Daniel Gonzalez
And even worse: I am setting, for testing: auth.settings.expiration = 3600 * 24 * 30 # one month But the session is expiring after 5 minutes anyway! What is happening here? On Tuesday, January 15, 2013 12:14:59 PM UTC+1, Daniel Gonzalez wrote: > > And a related question: my session is ex

Re: [web2py] Re: Fatal Python error: Couldn't create autoTLSkey mapping

2013-01-15 Thread Daniel Gonzalez
The links I sent are related to mod_wsgi / apache / python 2.7.2, but it is a generic python 2.7.2 problem. The problems do not happen always. What python version are you using? On Tuesday, January 15, 2013 1:20:16 PM UTC+1, Richard Penman wrote: > > I used subprocesses on my previous server wit

[web2py] Re: What is the timeout for the session?

2013-01-15 Thread Daniel Gonzalez
And a related question: my session is expiring after 5 minutes (300s). I am not setting the expiration time, and the default in Auth.default_settings.expiration is 3600. Where is the 300 coming from!?!? On Tuesday, January 15, 2013 11:57:03 AM UTC+1, Daniel Gonzalez wrote: > > Thanks N

[web2py] Re: Fatal Python error: Couldn't create autoTLSkey mapping

2013-01-15 Thread Daniel Gonzalez
I am actually researching the same problem. Please take a look here: https://groups.google.com/d/topic/modwsgi/DW-SlIb07rE/discussion http://bugs.python.org/issue13156 This is a bug in python 2.7.2, and has been solved in 2.7.3. I am also affected, and will have to upgrade all my servers :( On

[web2py] Re: What is the timeout for the session?

2013-01-15 Thread Daniel Gonzalez
Thanks Niphlod, I am now using: - session.auth.expiration - session.auth.last_visit And I have realized about one (at least for me) unexpected thing: accessing @service.jsonrpc controllers does not reset session.auth.last_visit. Is this intended? On Tuesday, January 15, 2013 11:43:11

[web2py] What is the timeout for the session?

2013-01-15 Thread Daniel Gonzalez
Hi, In one of my controllers I would to display: - what is the timeout for this session - how long has the current session still to stay active - a list of requests / timestamps (I guess this is not tracked in web2py) - when was the last request performed (unfortunately this will be t

Re: [web2py] Set up of db.py takes too long time

2013-01-15 Thread Daniel Gonzalez
No imports in the code-area profiled. Also, I am testing some requests, but the time I am measuring is the time spent in the code-area that I have provided. That is, in the define tables code. The controllers are of course making use of the table definitions later, but that is not what I am mea

Re: [web2py] Set up of db.py takes too long time

2013-01-15 Thread Daniel Gonzalez
Very few records (around 10). I am testing still. On Tuesday, January 15, 2013 9:23:43 AM UTC+1, rochacbruno wrote: > > > On Tue, Jan 15, 2013 at 6:20 AM, Daniel Gonzalez > > > wrote: > >> IS_NOT_IN_DB(db, '%s.email' % (web2py_user_table)) > > > If

[web2py] Set up of db.py takes too long time

2013-01-15 Thread Daniel Gonzalez
Hi, My db.py takes a long time to run (around 40 ms). This means that just the overhead of db.py limits my throughput to 25 req/s (in a single process / single thread configuration). This seems to me quite low. I have tried to take a look at where the time is spent. I have seen the following r

[web2py] Handling unicode keys in jsonrpc calls

2013-01-14 Thread Daniel Gonzalez
Recently web2py changed to parse the jsonrpc parameters in tools.py/Service.serve_jsonrpc. Now I have a frawework in my client (ember.js) which is sending unicode keys in the jsonrpc parameters. This causes the code to fail, like this: {"version": "1.1", "id": "ID1", "error": {"message": "TypeE

[web2py] Changes in jsonrpc calls?

2013-01-14 Thread Daniel Gonzalez
I am moving to a recent web2py version, and I realize that now the json parameters are parsed inside tools.serve_jsonrpc. Previously I was parsing them in my jsonrpc controller, so that means I have to adapt my controllers. Unexpected, but I can manage. My question is: Should I do simplejson.d

[web2py] Re: Strange import problem: is sys.path not used in web2py?

2013-01-14 Thread Daniel Gonzalez
I have found a workaround (hack) to my problem. I had to modify: INVALID_MODULES = set(('', 'gluon', 'applications', 'custom_import')) to INVALID_MODULES = set(('', 'gluon', 'applications', 'custom_import', 'nltk', 'collocations', 'numpy', 'testing')) (there were more modules affected by the s

[web2py] Re: Strange import problem: is sys.path not used in web2py?

2013-01-14 Thread Daniel Gonzalez
I have logged the import activity, modifying custom_import like this: FORMAT="%s -> %-40s %-10s %-10s %-10s %-10s" # if not relative and not from applications: if hasattr(current, 'request') \ and level <= 0 \ and not name.split('.')[0] in INVALID_MODULES \

[web2py] Re: Strange import problem: is sys.path not used in web2py?

2013-01-14 Thread Daniel Gonzalez
port nltk.data" goes through, but it shouldn't. Why could that be? (I do not understand the code very well) On Monday, January 14, 2013 11:52:26 AM UTC+1, Daniel Gonzalez wrote: > > Version 2.3.2 (2012-12-17 08:59:58) stable, commit 9557c46, in Ubuntu > 12.04.1 LTS. I am running

[web2py] Re: Strange import problem: is sys.path not used in web2py?

2013-01-14 Thread Daniel Gonzalez
Version 2.3.2 (2012-12-17 08:59:58) stable, commit 9557c46, in Ubuntu 12.04.1 LTS. I am running from a virtualenv with python 2.7.2. I have no idea how to force nltk to be found: the sys.path is correct, as I have verified by setting manually in the interpreter and running the import statement.

[web2py] Strange import problem: is sys.path not used in web2py?

2013-01-14 Thread Daniel Gonzalez
Hi, I have a problem with an import in my model: Traceback (most recent call last): File "/installdir/web2py/gluon/restricted.py", line 212, in restricted exec ccode in environment File "/installdir/web2py/applications/wavilon_portal/models/db.py", line 10, in import nltk.data Fil

[web2py] Re: Putting the session in memcache does not work

2013-01-13 Thread Daniel Gonzalez
valuated one-time-only can you try > restarting the web2py process (or apache, or uwsgi, depending on your > setup...) ? > > On Sunday, January 13, 2013 12:31:24 PM UTC+1, Daniel Gonzalez wrote: >> >> Hi, >> >> I have 0_memcache.py in my models, with f

[web2py] Putting the session in memcache does not work

2013-01-13 Thread Daniel Gonzalez
Hi, I have 0_memcache.py in my models, with following content: from gluon.contrib.memcache import MemcacheClient memcache_servers = ['127.0.0.1:11211'] cache.memcache = MemcacheClient(request, memcache_servers) cache.ram = cache.disk = cache.memcache Now in my db.py model, I have defined (close

[web2py] Make gluon components accessible in mod_wsgi

2013-01-13 Thread Daniel Gonzalez
Hi, As part of my library, I have a module which I use to wrap some web2py components. Let's say I have simple.py: from gluon.html import B def my_b(txt): return B(txt) To successfully import this module, my pwd needs to be the directory where web2py is installed. Otherwise I get the foll

[web2py] Running some code at the end of the request

2013-01-11 Thread Daniel Gonzalez
Hi, I would like to run some code when the request has been processed, but I do not want to modify all my controllers for this. To run something at the beginning of every request, I just need to put my code on the models/db.py. Is it possible to run code at the end of the request processing too?

[web2py] Re: Invalidated RAM cache from outside web2py to handle refreshing of asynchronous data

2013-01-11 Thread Daniel Gonzalez
In that case you can code a controller that does the trick and call > it, e.g., with curl from the commandline. > 2. same thing, curl from the commandline, or use urllib2, or something > that basically does a request to your webserver. > > Il giorno venerdì 11 gennaio 2013 14:53:27

[web2py] Re: Invalidated RAM cache from outside web2py to handle refreshing of asynchronous data

2013-01-11 Thread Daniel Gonzalez
key after clear() ASAP > > In the 1st case, after calling clear() you don't have to do nothing. > > In the 2nd case, either you call the controller "disguised as a user" or > you process the data and store it using cache.ram("*the_key*", thevalue) > >

[web2py] Invalidated RAM cache from outside web2py to handle refreshing of asynchronous data

2013-01-11 Thread Daniel Gonzalez
Hi, I am serving some data which is expensive to compute with a @service.jsonrpc controller. I want to cache the result in RAM, using something like: @cache(request.env.path_info,time_expire=1000,cache_model=cache.ram) My data will not change very often, so I want to have a big ttl (actually,

[web2py] Re: Establishin a session with contrib.WebClient

2012-12-24 Thread Daniel Gonzalez
with this for the time being. On Monday, December 24, 2012 2:38:48 PM UTC+1, Daniel Gonzalez wrote: > > Trying to answer some of my questions. > The redirects are handled by the client. In the case of WebClient probably > by the urrlib2 library. > Now my question is: how do I t

[web2py] Re: Using contrib.webclient to test JSONRPC interfaces

2012-12-24 Thread Daniel Gonzalez
, Massimo Di Pierro wrote: > > Hello Daniel, > > getting back at this. Why use webclient for this instead of using > gluon/contrib/simplejsonrpc.py? its seems to me it does not belong there. > > On Monday, 17 December 2012 14:01:18 UTC-6, Daniel Gonzalez wrote: >> >> I hav

[web2py] Re: Establishin a session with contrib.WebClient

2012-12-24 Thread Daniel Gonzalez
Trying to answer some of my questions. The redirects are handled by the client. In the case of WebClient probably by the urrlib2 library. Now my question is: how do I tell the urllib2 library used by WebClient to properly setup the cookies when following a redirect? Thanks, Daniel --

[web2py] Establishin a session with contrib.WebClient

2012-12-24 Thread Daniel Gonzalez
WebClient, but in between redirects the session is not yet set (only when testing with WebClient), which makes my test fail because session specific data which is setup during the redirect phase can not be configured. How to handle the redirects with WebClient? Thanks, Daniel Gonzalez --

[web2py] Web2py thread management

2012-12-18 Thread Daniel Gonzalez
Hi, How are threads managed in web2py? I am stress testing with a multithreaded programm, and I see that web2py spawns 14 "worker threads". These threads are not created/destroyed, but seem to run forever. python,8698 web2py.py -a |-{python},9005 |-{python},9023 |-{python},9042 |-{p

[web2py] Re: Using contrib.webclient to test JSONRPC interfaces

2012-12-18 Thread Daniel Gonzalez
6 AM UTC+1, Massimo Di Pierro wrote: > > you point me to the file? Is it this one? > > > https://github.com/gonvaled/web2py/blob/webclient_add_jsonrpc/gluon/contrib/webclient.py > > > On Monday, 17 December 2012 14:01:18 UTC-6, Daniel Gonzalez wrote: >> >> I h

[web2py] Reusing expensive objects

2012-12-17 Thread Daniel Gonzalez
Hi, My application uses some objects which are quite slow to setup. I create this object in the models file, so that they are available for all controllers. Specifically, most of my processing is delegated to a celery queue (based on rabbitmq). The interface to this queue is wrapped by a class

[web2py] web2py performance, without db

2012-12-17 Thread Daniel Gonzalez
Hi, I am trying to get some metrics on my installation. For that I have disabled the database (db=None) and I am requesting a very simple controller: def hello1(): return "Hello World" I have a multi-threaded test program which is sending requests to web2py (using WebClient). I have let m

[web2py] Re: Using contrib.webclient to test JSONRPC interfaces

2012-12-17 Thread Daniel Gonzalez
opener.addheaders.append((key,str(value))) is not working as (I) expected: the content-type is not rewritten: http://stackoverflow.com/questions/13920211/not-possible-to-set-content-type-to-application-json-using-urllib2 On Monday, December 17, 2012 6:38:30 PM UTC+1, Daniel Gonzalez wrote: > &

Re: [web2py] Specify password strengh, with error feedback

2012-12-17 Thread Daniel Gonzalez
onathan Lundell wrote: >> >> On 16 Dec 2012, at 3:47 PM, Daniel Gonzalez wrote: >> >> Is is possible to specify what kind of password is allowed? For example, >> let's say I want: >> >>- length >=8 >>- at least 1 uppercase >>

[web2py] Using contrib.webclient to test JSONRPC interfaces

2012-12-17 Thread Daniel Gonzalez
body of the POST request). Is this at all possible? Is there an example of WebClient usage for JSONRPC interfaces somewhere? Thanks, Daniel Gonzalez --

[web2py] Moving from 2.0.2 to R-2.3.1: undefined with globals in models

2012-12-16 Thread Daniel Gonzalez
Hi, My application is using 2.0.2 I have some global variables defined in db.py which I am using in my controllers. Now I have tried to move to the latest web2py version (2.3.1), and those globals can not be accessed from the controllers. Has there been any important change in this regard? Do I

[web2py] Specify password strengh, with error feedback

2012-12-16 Thread Daniel Gonzalez
Hi, Is is possible to specify what kind of password is allowed? For example, let's say I want: - length >=8 - at least 1 uppercase - at least 1 lowercase - at least 1 number - at least 1 char in a pre-defined set() I would also like to give the end-user information about why the

[web2py] Re: Prevent calling compute when doing an update

2012-12-16 Thread Daniel Gonzalez
wrote: > > You can set > > db.table.field.compute = lambda: > > only in the actions that need it. > > On Saturday, 15 December 2012 04:26:33 UTC-6, Daniel Gonzalez wrote: >> >> Hi, >> >> I am implementing a password update feature. I am doing some

[web2py] Prevent calling compute when doing an update

2012-12-15 Thread Daniel Gonzalez
nt update to do *anything* except updating the field that I am explicitly giving. Is this possible? Thanks, Daniel Gonzalez --

[web2py] Re: Forcing minus for converted parameter names in form helpers

2012-11-20 Thread Daniel Gonzalez
eturn DIV(*i, _class='btn-group', **{'_data-toggle': "buttons-radio" }) On Tuesday, November 20, 2012 9:50:48 AM UTC+1, Niphlod wrote: > > this is beginning to be a FAQ > > http://web2py.com/books/default/chapter/29/05?search=data- > > On Tuesday,

[web2py] Forcing minus for converted parameter names in form helpers

2012-11-20 Thread Daniel Gonzalez
Hi, I am trying to create a radio component in a custom web2py form, using twitter bootstrap styles, as explained here . In order for the button group to behave like a radio button, we need to specify the 'data-toggle="buttons-radio"'

[web2py] Showing a fixed URL for a web2py application

2012-10-29 Thread Daniel Gonzalez
Hi, In my application, I would like the URL being shown to the user to be always the same (http://www.myapp.com), no matter what page the user is currently browsing. The idea is that the user should not be confused about the internal structure of my application. The links in the page would rema

[web2py] Implementing a self-modifying form in web2py

2012-10-28 Thread Daniel Gonzalez
Hello, I am trying to implement a contact form (similar to the one in gmail) with web2py. I have problems implementing the following feature: the user should be able to expand the form, by adding new entries to the contact (for other telephone numbers, or other information). The user is present

[web2py] Display a list of dictionaries as an html table

2012-10-26 Thread Daniel Gonzalez
Hello, I am generating some data on the fly (no database), which I would like to display using a controller / view. The data is organized as a list of dictionaries, like this: headers = [ 'header1', 'header2' ] data = [ { 'col1' : 'valA', 'col2' : 'valB' }, { 'col1' : 'valC', 'col2' : 'valD

[web2py] Using PYTHONOPTIMIZE with web2py

2012-09-21 Thread Daniel Gonzalez
Hi, I am running web2py via apache wsgi. What is the suggested way to run the python interpreter with PYTHONOPTIMIZE? Are there any known incompatibilities between web2py and PYTHONOPTIMIZE? Thanks, Daniel --

[web2py] Re: Submitting a form with a link

2012-09-10 Thread Daniel Gonzalez
e form has been submitted? Thanks, Daniel On Monday, September 10, 2012 10:03:12 AM UTC+2, Daniel Gonzalez wrote: > > Hi, > > I am preparing a customized log-in form. I want to add a link to recover > the password, which is implemented with the A(..) element. > In the controller

  1   2   3   >