Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
views...
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Steve Ross  
View profile  
 More options Nov 10 2011, 8:53 pm
From: Steve Ross <nowhid...@gmail.com>
Date: Thu, 10 Nov 2011 20:53:31 -0500
Local: Thurs, Nov 10 2011 8:53 pm
Subject: views...

forgive my lack of knowledge of python but I am writing a method to get a
view and it works in javascript but in python it throws the following error:

*TypeError:* "'str' object is not callable"

function run<txmt://open?line=22&url=file:///Users/sross/greenlight/external/nightly _expiring.py>in
*nightly_expiring.py* at line 22

self.get_expiring(db)

function get_expiring<txmt://open?line=40&url=file:///Users/sross/greenlight/externa l/nightly_expiring.py>in
*nightly_expiring.py* at line 40

for row in db.view(view, params):

function __iter__ <txmt://open?line=984> in *untitled* at line 984

return iter(self.rows)

function rows <txmt://open?line=1003> in *untitled* at line 1003

self._fetch()

function _fetch <txmt://open?line=992> in *untitled* at line 992

self._rows = [wrapper(row) for row in data['rows']]

method:

def get_expiring(self, db_id):
db = self.server[db_id]
 now = datetime.date.today()
startkey = "%.0f" % time.mktime(now.timetuple())
delta = datetime.timedelta(days=30)
nowplus30 = now + delta
endkey = "%.0f" % time.mktime(nowplus30.timetuple())
 print startkey => 1320901200
 print endkey => 1323493200
 view = "_design/" + db_id + "/_view/certificate-by-date-list"
params =  "descending=false&startkey=["+ startkey +"]&endkey=[" + endkey +
"]"
# url: cert_by_date_url + '?descending=false&startkey=[]&endkey=[' +
todayPlus30 + ']',
 for row in db.view(view, params):
print row.id

--
Steve Ross
web application & interface developer
http://blog.stevensross.com
[mobile] (912) 344-8113
[ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Shorin  
View profile  
 More options Nov 11 2011, 12:04 am
From: Alexander Shorin <kxe...@gmail.com>
Date: Fri, 11 Nov 2011 08:04:57 +0300
Local: Fri, Nov 11 2011 12:04 am
Subject: Re: views...

Hi Steve

You should pass view params as keyword arguments, not string one.
http://packages.python.org/CouchDB/client.html#couchdb.client.Databas...

view = "_design/" + db_id + "/_view/certificate-by-date-list"
# params =  "descending=false&startkey=["+ startkey +"]&endkey=[" + endkey
+ "]"
# url: cert_by_date_url + '?descending=false&startkey=[]&endkey=[' +
todayPlus30 + ']',
params = {
'descending': False,
'startkey': [startkey],
'endkey': [endkey]

}

for row in db.view(view, **params):
 print row.id

--
,,,^..^,,,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Ross  
View profile  
 More options Nov 11 2011, 8:22 am
From: Steve Ross <nowhid...@gmail.com>
Date: Fri, 11 Nov 2011 08:22:04 -0500
Local: Fri, Nov 11 2011 8:22 am
Subject: Re: views...

Thanks I knew it was something simple.
On Nov 11, 2011 12:04 AM, "Alexander Shorin" <kxe...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Ross  
View profile  
 More options Nov 11 2011, 8:52 am
From: Steve Ross <nowhid...@gmail.com>
Date: Fri, 11 Nov 2011 05:52:43 -0800 (PST)
Local: Fri, Nov 11 2011 8:52 am
Subject: Re: views...
Should the docs be updated to reflect that? it just says "options –
optional query string parameters"

On Nov 11, 8:22 am, Steve Ross <nowhid...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Shorin  
View profile  
 More options Nov 11 2011, 9:01 am
From: Alexander Shorin <kxe...@gmail.com>
Date: Fri, 11 Nov 2011 17:01:17 +0300
Local: Fri, Nov 11 2011 9:01 am
Subject: Re: views...

On Fri, Nov 11, 2011 at 5:52 PM, Steve Ross <nowhid...@gmail.com> wrote:
> Should the docs be updated to reflect that? it just says "options –
> optional query string parameters"

I'd be happy to do it, but my English is too weak for that task ):
However, current description notes that you could pass any query
parameters, even your own and doesn't binds couchdb-python
documentation to CouchDB supported features.

--
,,,^..^,,,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Ross  
View profile  
 More options Nov 11 2011, 10:55 am
From: Steve Ross <nowhid...@gmail.com>
Date: Fri, 11 Nov 2011 10:55:02 -0500
Local: Fri, Nov 11 2011 10:55 am
Subject: Re: views...

since it is fairly typical to need to query by a date range it would be
nice if the couch lib would convert a date (or datetime) to epoch
(miliseconds) when sending in a param.

Not sure if everyone would want that but it would help me out!

--
Steve Ross
web application & interface developer
http://blog.stevensross.com
[mobile] (912) 344-8113
[ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ]

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Shorin  
View profile  
 More options Nov 11 2011, 11:03 am
From: Alexander Shorin <kxe...@gmail.com>
Date: Fri, 11 Nov 2011 19:03:29 +0300
Local: Fri, Nov 11 2011 11:03 am
Subject: Re: views...

On Fri, Nov 11, 2011 at 7:55 PM, Steve Ross <nowhid...@gmail.com> wrote:
> since it is fairly typical to need to query by a date range it would be nice
> if the couch lib would convert a date (or datetime) to epoch (miliseconds)
> when sending in a param.
> Not sure if everyone would want that but it would help me out!

I'll not agree with you in this case, due to date ranges could be
implemented in different ways. For example, for the last time I'd
prefer @rnewson idea(at least he mentioned it in IRC) about storing
datetime in array form as [yyyy, mm, dd, HH, MM, SS] - it provides
great statistic features over time. So datetime representation is
heavy dependend from task that you solves.

--
,,,^..^,,,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Ross  
View profile  
 More options Nov 11 2011, 11:08 am
From: Steve Ross <nowhid...@gmail.com>
Date: Fri, 11 Nov 2011 11:08:38 -0500
Local: Fri, Nov 11 2011 11:08 am
Subject: Re: views...

Hm... following #couchdb on IRC and the preferred method of storing dates
(I thought) was:

2011-11-03T04:00:00.000Z

and then the way of being able to select a range in couchdb is to
emit(Date.parse(doc.date)) since time is numeric it makes sorting /
selecting a range pretty easy...

anyway that is just how i am doing it.

--
Steve Ross
web application & interface developer
http://blog.stevensross.com
[mobile] (912) 344-8113
[ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ]

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Shorin  
View profile  
 More options Nov 11 2011, 11:26 am
From: Alexander Shorin <kxe...@gmail.com>
Date: Fri, 11 Nov 2011 19:26:39 +0300
Local: Fri, Nov 11 2011 11:26 am
Subject: Re: views...

On Fri, Nov 11, 2011 at 8:08 PM, Steve Ross <nowhid...@gmail.com> wrote:
> Hm... following #couchdb on IRC and the preferred method of storing dates (I
> thought) was:
> 2011-11-03T04:00:00.000Z
> and then the way of being able to select a range in couchdb is to
> emit(Date.parse(doc.date)) since time is numeric it makes sorting /
> selecting a range pretty easy...
> anyway that is just how i am doing it.

Yes, storing datetime values as ISO string format in universal method,
but all depends from tasks that you're solving(:

--
,,,^..^,,,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »