Issue with 0.8.1

11 views
Skip to first unread message

Acquaviva, Andrew

unread,
Jul 1, 2011, 9:45:31 AM7/1/11
to code...@googlegroups.com
I've just upgraded to 0.8.1 and am having trouble uploading any results to the page. Even using the example script save_single_result.py, it says that the date is formatted wrong:

HTTP Error 400: BAD REQUEST
{'date': [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.']}

I added a statement in the script to display the date and it all checked out fine and was in the right format:

2011-07-01 09:38:35.302429

So I don't really know what's going on. We've now got our FiPy Codespeed server set up and running on 0.8.1 but I get the same date format error. There seem to be no other problems though (I manually made up some data in the admin page and it displayed fine on all three tabs on the codespeed page), so it seems that it's just this date formatting thing that's an issue. Any ideas of the cause?

-Drew Acquaviva
FiPy Project

Frank Becker

unread,
Jul 1, 2011, 3:16:54 PM7/1/11
to code...@googlegroups.com
On 7/1/11 3:45 PM, Acquaviva, Andrew wrote:

Hi,

> I've just upgraded to 0.8.1 and am having trouble uploading any results to
> the page. Even using the example script save_single_result.py, it says that
> the date is formatted wrong:
>
> HTTP Error 400: BAD REQUEST
> {'date': [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]]
> format.']}

ACK, I can confirm that with current master.

[...]


> So I don't really know what's going on. We've now got our FiPy Codespeed

Well, the usual silly thing that takes ages to find ;)

└[a8@buoyancy-7]-speedcenter→git diff codespeed/views.py
diff --git a/speedcenter/codespeed/views.py b/speedcenter/codespeed/views.py
index 0640b61..d6db676 100644
--- a/speedcenter/codespeed/views.py
+++ b/speedcenter/codespeed/views.py
@@ -800,7 +800,7 @@ def save_result(data):
rev = branch.revisions.get(commitid=data['commitid'])
except Revision.DoesNotExist:
rev_date = data.get("revision_date")
- if not rev_date or rev_date == "":
+ if (not rev_date) or (rev_date == ""):
rev_date = datetime.today()
rev = Revision(branch=branch, commitid=data['commitid'],
date=rev_date)
try:

I'm currently writing a test and send a pull request w/ that fix.

Bye,

Frank

--
Frank Becker <f...@alien8.de> (jabber|mail) | http://twitter.com/41i3n8
GnuPG: 0xADC29ECD | F01B 5E9C 1D09 981B 5B40 50D3 C80F 7459 ADC2 9ECD
SILC-Net: a8 | Home: http://www.alien8.de | <<</>> http://www.c3d2.de
"> Freedom is just chaos, with better lighting. <" Alan Dean Foster

signature.asc

Frank Becker

unread,
Jul 1, 2011, 5:06:28 PM7/1/11
to code...@googlegroups.com
On 7/1/11 9:16 PM, Frank Becker wrote:
> On 7/1/11 3:45 PM, Acquaviva, Andrew wrote:

Hi,

>> HTTP Error 400: BAD REQUEST


>> {'date': [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]]
>> format.']}
> ACK, I can confirm that with current master.
>
> [...]
>> So I don't really know what's going on. We've now got our FiPy Codespeed
> Well, the usual silly thing that takes ages to find ;)
>
> └[a8@buoyancy-7]-speedcenter→git diff codespeed/views.py
> diff --git a/speedcenter/codespeed/views.py b/speedcenter/codespeed/views.py
> index 0640b61..d6db676 100644
> --- a/speedcenter/codespeed/views.py
> +++ b/speedcenter/codespeed/views.py
> @@ -800,7 +800,7 @@ def save_result(data):
> rev = branch.revisions.get(commitid=data['commitid'])
> except Revision.DoesNotExist:
> rev_date = data.get("revision_date")
> - if not rev_date or rev_date == "":
> + if (not rev_date) or (rev_date == ""):
> rev_date = datetime.today()
> rev = Revision(branch=branch, commitid=data['commitid'],
> date=rev_date)
> try:

Sorry, I was wrong. Forget what I wrote! Friday night seems not my time
for bug hunting ;)

save_single_result.py adds the key
'revision_date': None,
to the dict that is sent to codespeed.views.save_result(data).
urllib.urlencode(data) in save_single_result.py converts the None into
u'None'. Thus, the if up there in views.save_result(data) doesn't catch
it. That is a little confusing, there might be a good reason?

Change the if to:


- if not rev_date or rev_date == "":

+ if not rev_date or rev_date in ["", "None"]:

or maybe as a better solution avoid to add data["revision_date"]=None

signature.asc

Miquel Torres

unread,
Jul 2, 2011, 4:14:09 AM7/2/11
to code...@googlegroups.com
It is in master now. Thanks Frank!


2011/7/1 Frank Becker <f...@alien8.de>:

Acquaviva, Andrew

unread,
Jul 5, 2011, 10:29:47 AM7/5/11
to code...@googlegroups.com
Very well. I commented out the offending line in the example script. For our actual project we don't have None there so the problem solves itself. However, I'm still having a problem. Now it seems that the data uploads to the server without a problem but I can't see any of the data on the pages. I know it's there because I can see the results in the admin page. Using my local port (8000) I can see that when I try to access one of my executables on the changes page, the terminal running the local server gives me an error message:
 
lastrevision = lastrevisions[0]#same as self.revision unless in a different branch
File "/usr/lib/pymodules/python2.7/django/db/models/query.py", line 188, in __getitem__
    return list(qs)[0]
IndexError: list index out of range

They're pointing to models.py for that error message. I'm not sure what's going on. I've never dealt with data that it actually being uploaded but is unviewable. Any thoughts?

-Drew Acquaviva
FiPy Project

Miquel Torres

unread,
Jul 5, 2011, 3:36:19 PM7/5/11
to code...@googlegroups.com
Hi Drew,

Some questions to narrow possible error sources: Are you by any chance
using a branch other than "default"? and did you always save results
in the same way.

In any case I have committed a couple of improvements. The error you
saw should be caught and the changes table should at least load empty,
though we need to find it's cause because it was not supposed to
happen.

Can you please test with master?


2011/7/5 Acquaviva, Andrew <acqu...@stu.lemoyne.edu>:

Acquaviva, Andrew

unread,
Jul 6, 2011, 9:42:31 AM7/6/11
to code...@googlegroups.com
It seems that the branch title was the issue. I changed it from default. After changing it back and deleting reports with the offending branch title, it appears to work. Thanks again for the help.

-Drew Acquaviva
FiPy Project
Reply all
Reply to author
Forward
0 new messages