Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 54207 invoked from network); 2 Jun 2009 12:58:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Jun 2009 12:58:12 -0000 Received: (qmail 4847 invoked by uid 500); 2 Jun 2009 12:58:23 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 4772 invoked by uid 500); 2 Jun 2009 12:58:23 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 4762 invoked by uid 99); 2 Jun 2009 12:58:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2009 12:58:23 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2009 12:58:10 +0000 Received: from [192.168.1.102] (f053001038.adsl.alicedsl.de [::ffff:78.53.1.38]) (AUTH: LOGIN jan, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Tue, 02 Jun 2009 12:57:48 +0000 Message-Id: From: Jan Lehnardt To: user@couchdb.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: Sharing code between validation functions for different views. Date: Tue, 2 Jun 2009 14:57:47 +0200 References: X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org On 31 May 2009, at 05:46, macario wrote: > I am toying with document validation and I would like not to repeat > the same > validation functions on each validate_doc_update, > I've read that validate_doc_update for each view are ran in an order > given > by couchdb, so is there any way I can load some functions before the > whole > validation process? Do you mean validate_doc_update for each design document (each design document can include multiple views). You can't run a function before any one validation function. If we had a "pre_update_validate" hook, it'd need guaranteed execution order and if we'd want that we could add it for regular validation functions as well. As fast as sharing code, you can use CouchApp's* library feature, where your code only lives in one place when you develop, but gets copied when pushed to CouchDB. * http://github.com/couchapp/couchapp Cheers Jan --