[web2py] Re: Insert current datetime in layout.html

2010-06-14 Thread Niphlod
You can use request.now, that is a default datetime.datetime object.. e.g. (paste this on the view) month: {{=request.now.month}} day : {{=request.now.day}} ... On 14 Giu, 00:32, Giuseppe Luca Scrofani wrote: > Hi, how I can insert in a page not served by a controller (think > layout.

[web2py] Re: working with views or stored procedures.

2010-06-14 Thread Niphlod
you should set a primaryekey into the definition of the table.. (see http://groups.google.com/group/web2py/msg/c9848792a8999c5f) I think that simple selects are possibile on views On 13 Giu, 08:57, Sky wrote: > I need to display data from a VIEW ( not table) of database. > can any one help m

[web2py] small fix needed in appadmin.html

2010-07-01 Thread Niphlod
Hello, with the default layout the appadmin.html page needs a small fix (I'm using 1.79.2 but I see that it'll be the same with the trunk version): when the function requested is ccache, everything is wrapped in a . Now, with default base.css, .wrapper is : {left:20px; top:20px; position:abs

[web2py] web2py and basic auth

2010-08-02 Thread Niphlod
Hi, I'm going to rewrite an API made with webpy into web2py. This API is available only over https and I'd need to use basic auth. It's an API available only to cmdline clients such as curl, wget and so on. I think there's an error on the documentation (http://www.web2py.com/ book/default/chapte

[web2py] web2py basic auth

2010-08-02 Thread Niphlod
Hi, I'm going to rewrite a REST API made with webpy into web2py. This API is available only over https and I'd need to use basic auth. It's an API available only to cmdline clients such as curl, wget and so on. I think there's an error on the documentation (http://www.web2py.com/ book/default/ch

[web2py] Re: web2py basic auth

2010-08-02 Thread Niphlod
ok, I took a look into tools.py to get some more clear ideas. I did a little mess up here (tends to be really confusing), and actually: from gluon.contrib.login_methods.basic_auth import basic_auth and auth.settings.login_methods = [basic_auth()] are needed if we're going to authenticate a

[web2py] Re: web2py basic auth

2010-08-02 Thread Niphlod
ok, I took a look into tools.py to get some more clear ideas.it turns out that is a bit difficult to clean out the magic from Auth() I did a little mess up here (tends to be really confusing), and actually: from gluon.contrib.login_methods.basic_auth import basic_auth and auth.settings.logi

[web2py] Re: How to detect in controller that request is via AJAX?

2010-08-03 Thread Niphlod
+1 for this method, is pretty standard in other frameworks too. Also, according to http://www.w3.org/TR/XMLHttpRequest/#send , the Accept header must be set as '*/*'. (and I think that there is one too much "lower()"), : ... if request.env.http_x_requested_with.lower()=='xmlhttprequest': ...

[web2py] Re: web2py basic auth

2010-08-05 Thread Niphlod
ok, I digged more, and sadly I think that for problem 1) HTTP should be rewritten, or at least a new class should be extended to let more flexibility. Don't know if I'm boring some ultra-technical pythonist, but I'll try to explain what I managed to understand. this is how HTTP is defined in http

[web2py] Re: web2py basic auth

2010-08-05 Thread Niphlod
wonderful, this works, also if the workaround smells fishy ^_^ regarding response.status and response.header are they ignored at all ? On 5 Ago, 13:40, mdipierro wrote: > You can do > > a= {'foo-':'bar','bar':'foo'} > HTTP(404,**a

[web2py] Re: web2py basic auth

2010-08-05 Thread Niphlod
uhm, I am obviously missing something def test(): response.headers['custom'] = 'miao' response.status = 404 return 'hello' GET http://127.0.0.1:8000/ciao/default/test Status: 200 OK Body: hello Set-Cookie: session_id_ciao=127-0-0-1-c8d0e6d1- fa92-4cfe-9720-9cf4dc3cddc2; Path=/

[web2py] Re: web2py basic auth

2010-08-05 Thread Niphlod
perfectly working, thanks again.

[web2py] Re: JQGrid Plugin with multiple Databases

2010-08-12 Thread Niphlod
actually it's the way it works that doesn't look "right" manage all the data within a single function/controller leads to have to pass around with parameters a long list of variables. I had to use jqgrid extensively, also on multiple dbs, with a lot of different configs no way I could use

[web2py] Re: Access Control and Basic Authentication ?

2010-08-15 Thread Niphlod
how are you posting data to the consumer ? apart from auth.settings.allow_basic_login = True there's nothing I did to enable itand it's working (sadly not the way I'd like, but works as intended (additional method of authentication...))

[web2py] Re: Access Control and Basic Authentication ?

2010-08-16 Thread Niphlod
I usually use curl and derivatives in order to help me/us knowing what's going on, could you please save somewhere the request object and past here it ?

[web2py] Re: Access Control and Basic Authentication ?

2010-08-16 Thread Niphlod
if you save request.headers somewhere I think it'll be easy to see the differences.... Niphlod On Aug 16, 11:02 am, David Marko wrote: > U just downloaded cURL for windows and tried this. And its working ... > so it not web2py issue but something on my side ... will try to look &

[web2py] Re: Access Control and Basic Authentication ?

2010-08-17 Thread Niphlod
like if foo and not bar: auth.settings.foobar with the scaffolding app (or the default values) being: auth.settings.foobar = redirect(self.settings.login_url + '? _next='+urllib.quote(next)) so I could make auth.settings.foobar = raise HTTP(403) or something like that

[web2py] lazy virtualfields

2010-08-21 Thread Niphlod
so, I read the docs and. I think either there's a bug or I'm doing something wrong in db.py --- . db.define_table('test', Field('name', length=5) ) class TestLazy: def lazy_test_field(self): def lazy(self=self): re

[web2py] Re: Understanding SQLFORM

2010-08-22 Thread Niphlod
iving away the chance to your users to change the "user" field, "assigning" his "services" row to another user definitely not the way to go. I'll be happy to set also form.vars.user.readable = False to hide the field at all, but that's your choice. Feel free to ask more if you're concerned by something or if you didn't understand all. Niphlod

[web2py] nice model, weird things

2010-08-22 Thread Niphlod
hello everybody.with this model I get some really strange behavioursis this a bug or a web2py limitation ? db.py --- db.define_table('tablefoo', Field('foo', length=5) ) db.define_table('tablebar', Field('bar', length=5)

[web2py] Re: Understanding SQLFORM

2010-08-23 Thread Niphlod
+1 for the latter, I totally forgot to point also the error on form.vars @david, try the last one by mdipierro and tell us if the problem of submitting the form goes away.. Niphlod On 23 Ago, 03:28, mdipierro wrote: > Your code can be simplified as follows: > This is inc

[web2py] Re: nice model, weird things

2010-08-23 Thread Niphlod
nice! It works perfectly. Sorry if that annoyed you, but I tend to implement functionality before nice representing, and the format parameter is quite always the last one in the development process. I'll try to push up that in the line of priorities ;-) Thanks again Niphlod On 23 Ago,

[web2py] Re: lazy virtualfields

2010-08-26 Thread Niphlod
t is wrong. Feel free to ask, of course, if you need more details. Niphlod

[web2py] Re: Pagination manual bug?

2010-08-26 Thread Niphlod
@dlin: it doesn't works because URL helper has been "improved" lately, in case you were asking yourself. PS: sadly if you put "web2py pagination" on google, the first link that appears is from mengu.net and that implementation is wrong, also if the analysis is correct. limitby works like python

[web2py] Re: uWSGI examples page updated for web2py

2010-08-27 Thread Niphlod
- (please do not get too excited about the next lines) - no way ;-) tks. Niphlod

[web2py] Re: lazy virtualfields

2010-09-09 Thread Niphlod
Perfect I think this can be added to the relevant section of the book, I didn't find anything about that, also on the internet... Thanks a lot, though. Niphlod On 8 Set, 03:08, mdipierro wrote: > Sorry for the lat reply. This is not a bug. This is a design issue and > trade

[web2py] Re: rise HTML

2010-09-11 Thread Niphlod
if you are raising exceptions directly in the controller, you can avoid the "extra" Xs doing something like raise HTTP(404, ['message']) (i.e. if an error message is of type "list" the Xs are not added) Niphlod On 11 Set, 16:28, mdipierro wrote: > You can. &g

[web2py] Re: web2py basic auth

2010-09-22 Thread Niphlod
ptional) form validation (via Django), throttling, etc. (I think that web2py has yet goodies to do it) - Supports streaming, with a small memory footprint. (web2py has it) - Stays out of your way. (but requires django^_^) On 5 Ago, 21:56, Niphlod wrote: > perfectly working, thanks again.

[web2py] Re: web2py basic auth

2010-09-22 Thread Niphlod
I'm really sorry I'm looking for an answer to this question: 2) I saw what auth.settings.allow_basic_login = True does (and auth.basic()) and it "allows" the basic authentication in addition to the default auth (also with disabled actions). Maybe the default auth can be shut down totally? Tha

[web2py] Re: web2py basic auth

2010-09-23 Thread Niphlod
ogin_url=URL('your_own_error_page') > > On Sep 22, 2:27 pm, Niphlod wrote: > > > > > I'm really sorry > > > I'm looking for an answer to this question: > > 2) I saw what auth.settings.allow_basic_login = True does (and > > auth.basi

[web2py] Re: does google rss work for you?

2010-09-23 Thread Niphlod
just change the user agent and it will work. e.g. wget -u konqueror http://groups.google.com/group/web2py/feed/rss_v2_0_msgs.xml or curl --user-agent konqueror http://groups.google.com/group/web2py/feed/rss_v2_0_msgs.xml work both On 23 Set, 10:47, b vivek wrote: > No massimo, does not w

[web2py] Re: web2py basic auth

2010-09-23 Thread Niphlod
would be best. Want to send me a patch? > > On Sep 23, 2:26 am, Niphlod wrote: > > > > > I'll try in other words. I/we (users building rest api) don't want > > the user to be redirected to any page (my own or the default really > > doesn't matt

[web2py] Re: web2py basic auth

2010-09-23 Thread Niphlod
would be best. Want to send me a patch? > > On Sep 23, 2:26 am, Niphlod wrote: >

[web2py] Re: still stuck with services and authentication

2010-10-28 Thread Niphlod
how are you passing along requests from apache to web2py ? can you monitor if web2py actually receive all the headers you send ? something like def test(): with os.open("path/to/file", 'wb') as g: for k,v in request.env.iteritems(): if k.startswith('http_'):

[web2py] Re: still stuck with services and authentication

2010-10-28 Thread Niphlod
not that I don't trust webfaction setup scripts, but there are a few shortcomings in passing along the auth headers fcgi to say one needs an extra parameter. Niphlod On Oct 29, 1:00 am, Niphlod wrote: > how are you passing along requests from apache to web2py ? > can you monito

[web2py] Re: still stuck with services and authentication

2010-10-28 Thread Niphlod
,v)) for k,v in request.env.iteritems() if k.startswith('http_')] return ('\n').join(heads) and try to retrieve the page with urllib.urlopen with user and pass and see the output. Niphlod On Oct 29, 1:00 am, Niphlod wrote: > how are you passing along requests from apache to web2py

[web2py] Re: An upsert in database

2010-10-31 Thread Niphlod
does db.executesql not fit ? Niphlod On 31 Ott, 18:01, siddharth wrote: > Hi, I need to do an upsert in a database table. I need to insert a row > if it does not exist already and and update it if it does. > using python sqlite module I was writing the code as > > code (python :

[web2py] little bug in last web2py (maybe in a few last releases also)

2010-10-31 Thread Niphlod
imply rendered as "decimal". the current web2py_ajax checks for "decimal" as a class with the following snippet jQuery('input.double,input.decimal').keyup() - and in this way pre-validation does not work. Niphlod

[web2py] Re: I may have missed some posts....

2010-11-01 Thread Niphlod
http://groups.google.com/group/web2py/browse_thread/thread/cd38fff1f1f4ea86# small issue, nevertheless, ping! Niphlod On 1 Nov, 20:52, villas wrote: > Regarding updated version of ClockPick in calendar.js > > http://groups.google.com/group/web2py/browse_thread/thread/4ce2dc84c4...

[web2py] Re: CLEANUP validator

2010-11-07 Thread Niphlod
lement of the tuple (the second one contains the errors usually but CLEANUP validator don't return them) - ('hello world', None) #the ! has been removed - ('hi this is going to be stripped', None) # leading and trailing space removed - ('uk3 k1Walker', None) # $ a

[web2py] Re: MSSQL Select statements

2010-11-13 Thread Niphlod
uhm are you using existing tables or you are using web2py to create them ?? dbo shouldn't affect at all the query, but a few hints nonetheless : master is a really nasty place to create tables "master" db should be left untouched in web2py you define a database when you istantiate

[web2py] Re: Easy to do using executesql, how to achieve with DAL?

2010-11-17 Thread Niphlod
+1 for examples, it's quite unusable. that is also accomplished with this query, only if not seeking other values db4(db4.data_table).select(db4.data_table.reqtime, limitby=(0,1), orderby=db4.data_table.reqtime) Niphlod On 17 Nov, 20:57, Lorin Rivers wrote: > I think this woul

[web2py] Re: Python Message Queue

2010-11-19 Thread Niphlod
the only thing on multiprocessing's queue that I don't like (it's not its fault, but psycopg's one) is that I have to create multiple connections (one for every process) to the database. Multiprocessing's queue, threading one, deque are where you end up with your hands dirty if you need persi

[web2py] Re: one more security feature in trunk

2010-11-25 Thread Niphlod
Italy if you turn down the connection (or the router), you get a different IP address. For me it's not a problem, but probably some people think differently. Niphlod On 25 Nov, 17:55, Kuba Kucharski wrote: > @massimo > > this sounds good, although stealing creditentials/interceptin

[web2py] Re: Merry Christmas

2010-12-23 Thread Niphlod
+1 On Dec 23, 8:51 pm, Pepe Araya wrote: > Hey! > > Merry Christmas!! > > good vibes for all!

[web2py] Re: web2py Turnkey Linux Appliance (collaborator needed)

2010-12-30 Thread Niphlod
uhm virtually very very very draft of Jonathan's concept. in gluon/widget.py , after "if '-A' in sys.argv: k = sys.argv.index('- A')" (line 695, in trunk), add: parser.add_option('', '--exit', action='store_true', dest='fo

[web2py] Re: web2py Turnkey Linux Appliance (collaborator needed)

2010-12-30 Thread Niphlod
PS: on line 561 of gluon/main.py of trunk there's a typo: INPORTANT instead of IMPORTANT

[web2py] Re: web2py Turnkey Linux Appliance (collaborator needed)

2010-12-30 Thread Niphlod
glad to be helpful and give my 2 cents to this community. your helptext is definetely acceptable, in the long run maybe a comment in the code will be more helpful than the "explicit" helpstring of optparse Niphlod On Dec 30, 11:06 pm, Jonathan Lundell wrote: > On Dec 30, 2010

[web2py] Re: web2py Turnkey Linux Appliance (collaborator needed)

2010-12-30 Thread Niphlod
PM, ghoulmann wrote: > > > > > Jonathon, Niphlod, Massimo, thank you for taking the time to write. I > > think I know much less than I implied in my original post. > > > Is the Jonathon and Niphlod produced something I can simply drop into / > > usr/lib/inithooks/fir

[web2py] Re: web2py and external editors

2011-01-19 Thread Niphlod
never tried but 2 possibilities arise: - put all imports in the head of the code I personally use tips from http://pierreth.blogspot.com/2010/10/web2py-eclipse-pydev-recipe.html (search the section starting with "Avoiding warning and errors with Pydev") with a few variations - explore the ca

[web2py] web2py and uploadify

2011-01-26 Thread Niphlod
Hello, I'm working on integrating uploadify with web2py Unfortunately uploadify doesn't use cookies at all when posting the files so if I want to "assign" an user to an uploaded file I need to secure the "receiving" function somehow. Uploadify can definitely add a parameter on every POST it doe

[web2py] Re: encoding problem

2011-01-26 Thread Niphlod
did you look into http://code.google.com/p/jquery-json/issues/detail?id=43 ? json.loads in web2py fits well with unicode maybe it's jquery- json and browser implementation that screws something up. On 26 Gen, 20:51, Marin Pranjic wrote: > It's not web2py related, but I hope someone can help

[web2py] Re: migrating auth_user table to another app

2011-01-26 Thread Niphlod
as long as you don't mind have the same auth.settings.hmac_key in the new application nothing will break, as far as i know, copying the data from auth_* tables to your new (fresh, without a single insert done) app. @villas, VP csv import/export is totally usable for me villas method also

[web2py] Re: Getting the id of submitted form...

2011-01-26 Thread Niphlod
in other techical words, you can't know in advance what id will have the "line" you are inserting toyou know that only after actually inserting the row into the database On 25 Gen, 15:48, DenesL wrote: > Hi Jason, > > onvalidation runs before the record is inserted so form.vars.id does > not

[web2py] Re: can web2py support RESTful api calls? if so any pointers on how to build one?I

2011-01-26 Thread Niphlod
it's completely possibile and URL designing in web2py is easy adhere to RESTfulness is a piece of cake. It is a challenge to understand what do you imply saying "RESTful" and to be honest there are strict or lazy ways to stick to the "REST bible"... I'm not an Iphone dev but, admitted that yo

[web2py] Re: Fwd: web2py basic auth

2011-01-28 Thread Niphlod
- Forwarded message -- > From: mdipierro > Date: Sep 23 2010, 2:34 pm > Subject: web2py basic auth > To: web2py-users > > Against trunk please. It is ok if you just send me a replacement file. > I will diff and study it. > > On Sep 23, 8:52 am, Niphlod wrote:

[web2py] Re: Fwd: web2py basic auth

2011-01-29 Thread Niphlod
sorry, my mistake! On Jan 29, 4:01 pm, Miguel Lopes wrote: > gluons/tools.py > > Txs, > Miguel > > On Sat, Jan 29, 2011 at 12:29 AM, Niphlod wrote: > > call_or_redirect() is the real "addition" here you can use both a > > URL or a functio

[web2py] Re: Modify calendar.js

2011-01-29 Thread Niphlod
datetime format is tied to datetime representation and that's bind to T() operator this snippet comes from web2py_ajax.html and it's responsible of calendar.js way to display time try {jQuery("input.date").live('focus',function() {Calendar.setup({ inputField:this, ifFormat:"{{=T('%

[web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Niphlod
I'm on my way out as a first thing, try it with auth.settings.on_failed_authorization = failedAuthHandler() On Jan 30, 9:29 pm, Miguel Lopes wrote: > I'm still in need of help. Here's what I've managed to find. > My problem is that if I don't use good credentials in the command line > I get

[web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Niphlod
try with auth.settings.on_failed_authorization = failedAuthHandlerandler() it works for me ^_^ On Jan 30, 9:29 pm, Miguel Lopes wrote: > I'm still in need of help. Here's what I've managed to find. > My problem is that if I don't use good credentials in the command line > I get an exception b

[web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Niphlod
ase. On Jan 30, 10:57 pm, Miguel Lopes wrote: > On Sun, Jan 30, 2011 at 9:16 PM, Niphlod wrote: > > try with auth.settings.on_failed_authorization = > > failedAuthHandlerandler() > > >  it works for me ^_^ > > Not for me! And I can't see how. > Miguel

[web2py] Re: Asyncronous Application Sync

2012-07-11 Thread Niphlod
I don't think there is something already written, however we could use some more info about it - how many data are we talking about ? - what does it mean "as soon as there is availability of connectivity" ? Given that, the approximate design for this kind of things is some form of interopera

[web2py] Scheduler: help us test it while learning

2012-07-12 Thread Niphlod
regular web2py users, I created a test app with two main objectives: documenting the new scheduler and test the features. App is available on github (https://github.com/niphlod/w2p_scheduler_tests). All you need is download the trunk version of web2py, download the app and play with it. Current

[web2py] Re: displaying errors for list:string types

2012-07-13 Thread Niphlod
uhm, I tested your on trunk, and also switched some things because I don't have db.raw_material and db.run_as_rm, but def add_composition(): form = SQLFORM.factory( Field('dog_id', requires = IS_EMPTY_OR(IS_IN_SET(['a','b','c']))), Field('cat_id', requires = IS_EMPTY_OR(IS_IN_

Re: [web2py] Re: query using groupby and distinct count

2012-07-13 Thread Niphlod
key, I finally got it (I guess). Men, sometimes reading through lines of posts without examples is hard! @all: we're circling around here because no distinctions were properly made in this thread for count() as a method attached to the Field vs the count() method attached to the table. @Fa

[web2py] Re: Scheduler: help us test it while learning

2012-07-15 Thread Niphlod
Maybe if you tell what issues you have we'll be able to help you . On Sunday, July 15, 2012 9:58:55 PM UTC+2, Pystar wrote: > > I am having issues installing the app in the web2py 2.0.0 dev version > > On Thursday, July 12, 2012 9:36:38 PM UTC+1, Niphlod wrote: >> >

[web2py] Re: how to delete records from table older than 1 day?

2012-07-16 Thread Niphlod
Why write such a query when DAL allows you to use a more (portable, concise) pythonic way ? import datetime yesterday = request.now - datetime.timedelta(days=1) db(db.employee.created_on < yesterday).delete() On Monday, July 16, 2012 12:12:56 PM UTC+2, Amit wrote: > > Hi, > I have created tabl

[web2py] Re: Need a little help with DAL

2012-07-16 Thread Niphlod
I can't reproduce the error. What db engine are you using and what web2py version are you running ? On Monday, July 16, 2012 2:35:15 PM UTC+2, Aurelijus Useckas wrote: > > Hi, > > I have declared a table 'company' and the Field 'workers' which expects > the number of workers in the company: >

Re: [web2py] Re: Help! IOErrors

2012-07-16 Thread Niphlod
I'm storing sessions on database for my app with no apparent problems (1.99.7 stable) for storing them in redis, currently there is no way (sorry). When I implemented cache in redis it seemed that I was the only one using a redis stack along web2py...generally redis adoption is quite sparse

Re: [web2py] Re: Help! IOErrors

2012-07-16 Thread Niphlod
te the DB is going to slow down a lot. > > I am trying to figure out a way how to handle sessions on the client site > as secure as possible so the servers don't get hit hard > > On Mon, Jul 16, 2012 at 11:44 AM, Niphlod wrote: > >> I'm storing sessions on database f

[web2py] Re: Scheduler: help us test it while learning

2012-07-17 Thread Niphlod
instructions: download the archive from https://github.com/niphlod/w2p_scheduler_tests/zipball/master. the zip contains a folder (now it is named "niphlod-w2p_scheduler_tests-903ee75"). Decompress that folder under "applications" and rename it to "w2p_scheduler_tests

[web2py] Re: Scheduler: help us test it while learning

2012-07-18 Thread Niphlod
STOPPED tasks gets requeued as soon as there is an ACTIVE worker around. The "philosophy" behind is that if a worker has been stopped (abruptly) your task never finished, so it gets "another shot" with the next worker. The scheduler_run table will grow as long as you need results. As documented,

[web2py] Re: how to compare date time in web2py?

2012-07-19 Thread Niphlod
current datetime is: request.now or import datetime datetime.datetime.now() Il giorno giovedì 19 luglio 2012 11:05:41 UTC+2, Amit ha scritto: > > Hi, > I have some records in a table and each record is having one field of type > datetime [fromat : 2012-07-19 23:12:0 (-MM-DD HH:MM:SS)], tabl

[web2py] Re: Create popular today query

2012-07-19 Thread Niphlod
The "linear" (faster, cleaner, smarted) way to do this is: db.define_table('views_by_day', Field('page'), Field('refdate', 'date'), Field('view_counter', 'integer') ) Then, db(db.views_by_day.refdate == request.now.date()).select(limitby=(0,10), orderby=~db.views_by_day.view

Re: [web2py] DAL/Postgres not creating a table

2012-07-21 Thread Niphlod
on sql.log in your databases folder there is the excerpt of the statements used to create the table. I'm guessing that you implemented your app adding here and there tables but never defining them "in order" . This seems the kind of problem when you try to create a table with foreign keys poin

[web2py] Re: Builtin Editor not working in latest Trunk

2012-07-21 Thread Niphlod
Also, try hitting ctrl+R (or ctrl+f5, etc etc etc) to reload all the static files in your browser. Some time ago with trunk I had the same issue and got it working simply refreshing the browser cache. On Saturday, July 21, 2012 11:24:57 AM UTC+2, Massimo Di Pierro wrote: > > Not quite. The ACE

[web2py] Re: validate_and_insert() question

2012-07-23 Thread Niphlod
If you can't understand the code, just try it: web2py.py -M -S mytestapp db.define_table( 'tests', Field('uniquefield', unique=True), Field('withvalidator', requires=IS_NOT_IN_DB(db, 'tests.withvalidator')) ) >>> ret = db.tests.validate_and_insert(uniquefield='a', withvalidator='b') >

[web2py] Re: validate_and_insert() question

2012-07-23 Thread Niphlod
With that statement ("""if you don't understand the code, try it""") I meant that you can always check a functionality testing it before loosing your mind on the code. All the "magic" is done by: gluon/dal.py (validate_and_insert()) ... for key,value in fields.items(): value,error

[web2py] Re: Pagination with no database

2012-07-23 Thread Niphlod
That's math! e.g. records_per_page = 10 records all_records = 137 records pages_needed = all_records / records_per_page (division) last_page = all_records % records_per_page (module) that is 13 "full pages" + 1 page with 7 records. So, you'll have to count the total of your records, divide it by

[web2py] Re: Pagination with no database

2012-07-23 Thread Niphlod
dohertyd wrote: > > Thank you for that makes perfect sense. This might be a stupid question > but do I need to create an individual HTML page for each result set? The > whole pagination thing is a mystery to me! > > On Monday, 23 July 2012 21:33:34 UTC+1, Niphlod wrote: >&

[web2py] Re: Newbie: interactive monitoring of a scheduler job?

2012-07-24 Thread Niphlod
mentations, but I made an app using extensively the scheduler (and tested it throughly). You can find the code on https://github.com/niphlod/w2p_tvseries/ . I'm using the periodicalupdater jquery plugin to ease off the cruft for "start monitoring, poll every n seconds, stop when done&qu

[web2py] Re: Error using Scheduler with CouchDB

2012-07-25 Thread Niphlod
Scheduler was meant to run on relational dbs. Actually, I think noone ever tested it on Nosql adapters, but if this is a popular requirement I could see into it. BTW, I posted an app to test the scheduler in trunk for this kind of tests. https://groups.google.com/d/topic/web2py/E_mASrZIpvw/disc

Re: [web2py] BR()

2012-07-25 Thread Niphlod
1.99.7 {{=XML(BR().xml()*5)}} works ok. On Wednesday, July 25, 2012 9:17:04 PM UTC+2, Derek wrote: > > nope... > unsupported operand type(s) for *: 'BR' and > 'int' > and also... > 'BR' object has no attribute 'XML' > > On Wednesday, July 25, 2012 12:09:24 PM UTC-7, Derek wrote: >> >> Ok, how

[web2py] Re: email question, and mysterious variable behavior

2012-07-25 Thread Niphlod
mail.settings.server needs to be ('logging' for debugging purposes or) an ip(:port) where a mail daemon is listening, not the http address of a web2py instance.. And again (this rises up quite a bit): DAL is not an ORM. DAL is a Database Abstraction Layer, not an Object Relational Mapper.

[web2py] Re: email question, and mysterious variable behavior

2012-07-25 Thread Niphlod
'logging' gets the raw email printed on the console. it is only for debugging purposes. BTW (and I mean no harm on that): I get that asking on such an active list is "speedier" than having to read documentation, but since you are going to use the feature, why don't you just go and read about it

[web2py] Re: Error using Scheduler with CouchDB

2012-07-26 Thread Niphlod
r postgres it's possible to process tasks with even more concurrent workers (I'd still keep them 50 at most). The only downside of SQLite instead of a "full relational db" is that you can't share the db among different machines. On Thursday, July 26, 2012 7:03:44

[web2py] Re: Error using Scheduler with CouchDB

2012-07-26 Thread Niphlod
> Hot to activate SQLite WAL when using DAL? > you need to have a sqlite3 (or pysqlite2) linked to a sqlite version >= 3.7.0. There are two version number: the module itself and the linked static library (.so on unix and .dll on Windows) >>> import sqlite3 #or from pysqlite2 import dbapi2 a

[web2py] Re: Complex query with left outer join

2012-07-26 Thread Niphlod
Currently you'd have to code a view in the database (or simply a "string" condition to pass on) to achieve that. date.today() - timedelta(something) is a python "fixed" value that doesn't get re-evaluated at runtime by the database substituting the "something" for each value of every row. If

[web2py] Re: table auth_user already exists

2012-07-26 Thread Niphlod
all of this instead of migrate=False where you know a table already exist ? On Thursday, July 26, 2012 5:23:50 PM UTC+2, Chris wrote: > > I've found what seems a simple way to let multiple apps share a DB and > create the same table definitions without conflict. Chris, you may find > this

[web2py] Re: mysql migration 5.0 to 5.5 - migrate=False, getting auth_users already exists

2012-07-26 Thread Niphlod
yep. migrate=False in DAL set migrate=False for table definitions. the auth.define_table() needs to be set to migrate=False explicitely. On Thursday, July 26, 2012 5:48:23 PM UTC+2, wdtatenh wrote: > > I had to migrate to mysql 5.5. for another application I have. I did not > attempt to migra

[web2py] Re: Complex query with left outer join

2012-07-26 Thread Niphlod
s from ~25 min to ~47 sec. On Thursday, July 26, 2012 6:03:24 PM UTC+2, jw wrote: > > cards2learn.exclude(lambda row: row.userCard.lastTimeLearned > date.today > () - timedelta(days=row.userCard.stage)) > > Niphlod, you made my day!! Thank you so much! And thank you all for t

[web2py] Re: Referencing user results in syntax-error?

2012-07-27 Thread Niphlod
Massimo is right, but you're having the error for another reason. it's plain and clear (*Variables* section). You are also lucky that in all of this statement there is only one dot. ('ALTER TABLE rsvp_list ADD event_id INTEGER REFERENCES db.event (id) ON DELETE CASCADE;',) you have Field('ev

Re: [web2py] Again: how redirect without propagate the .load extension?

2012-07-27 Thread Niphlod
I've not tested it, but there's a misunderstanding here I think. Say that "URL() gets the extension from the current request if not specified" is true. This is generally "wanted" because links in a LOADed portion of the frame must not contain the whole layout. But I think you want a LOADed for

[web2py] Re: session.about[0].NodeNav.nodeID!=session.id error.

2012-07-28 Thread Niphlod
if you read it carefully you find that your session.about[0].NodeNav is not a dict containing a nodeID key. just print session.about[0].nodenav before that statement and see what is it. On Saturday, July 28, 2012 11:27:39 AM UTC+2, Annet wrote: > > This code is part of a function: > > session.ab

[web2py] Re: Running SSH commands and capturing the results (Threading)

2012-07-30 Thread Niphlod
usually python webservers execute your functions in their own threads, and starting your own (threads) is always not recommended. For things like that you'd have to resort to an external process executing your code, and collecting the results somewhere where the app can fetch it (in an async way

[web2py] Re: Link stats through rerouting URL (geoip)

2012-07-30 Thread Niphlod
in order to save some processing juice (if you expect a lot of visits), just save the ip and calculate the region later with something like python-geoip. Il giorno domenica 29 luglio 2012 23:10:41 UTC+2, BlueShadow ha scritto: > > Hi, > I like to get information about usage of a link to an outsi

[web2py] Re: Link stats through rerouting URL (geoip)

2012-07-30 Thread Niphlod
see http://web2py.com/books/default/chapter/29/4#request request.client is the best bet. Il giorno lunedì 30 luglio 2012 11:10:20 UTC+2, BlueShadow ha scritto: > > Thanks Nighlod. can you also tell me how I save the IP? > --

[web2py] Re: Adding icons to navbar (response.menu)?

2012-07-30 Thread Niphlod
if adding the icon to the text of the menu would not work, you can still serialize in output your own menu. Normal web2py syntax allows some degree of customization, but if you want your own you can serialize your structure using the standard templating language. Il giorno lunedì 30 luglio 2012

Re: [web2py] Re: SqlServer find a field among all tables

2012-07-30 Thread Niphlod
This is not a question for web2py-users (if you need this you'll have to use it once in a while I hope, it's terribily slow). For having this work with web2py you should find a way to infere sql tables to models for using web2py, and I don't think something like this can be done with the st

[web2py] Re: unexpected keyword argument 'salt'

2012-07-30 Thread Niphlod
probably you need to update your welcome.w2p too (i.e. your welcome.w2p is a zip of an old scaffolding app.) Try to delete it if you have it in the same folder web2py.py is (it will be automatically recreated starting from applications/welcome) Il giorno lunedì 30 luglio 2012 16:21:50 UTC+2, And

  1   2   3   4   5   6   7   8   9   10   >