Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload Exam XML File #37

Open
mhrivnak opened this issue Nov 6, 2011 · 9 comments
Open

Upload Exam XML File #37

mhrivnak opened this issue Nov 6, 2011 · 9 comments
Assignees
Labels
Milestone

Comments

@mhrivnak
Copy link
Member

mhrivnak commented Nov 6, 2011

Our code can import an exam from XML. However, at the moment the only way to do so is to pass the XML as a string over RPC. This is a pain because Flex cannot read the contents of local files, so the user has to open an XML file in some other app and then copy-paste the text into Flex. We should be able to just upload the file.

See pr_services.ImportManager for how we upload CSV files, and this should probably be done in a similar way. Once the file is uploaded, its contents can be passed to ExamManager.create_from_xml()

@mhrivnak
Copy link
Member Author

mhrivnak commented Nov 6, 2011

Also, look in pr_services.exam_system.tests to see how XML upload is currently done and to obtain a sample XML file.

@ghost ghost assigned jc0n Nov 8, 2011
@jc0n
Copy link
Member

jc0n commented Nov 8, 2011

This isn't directly related but what is the difference between user and owner attributes in the CSVData model?

@jc0n
Copy link
Member

jc0n commented Nov 8, 2011

I'm also having a hard time finding the tests for Utils.upload_csv(). I was going to look at those for reference as well.

@mhrivnak
Copy link
Member Author

mhrivnak commented Nov 8, 2011

Once upon a time, a developer had a great idea to create the "OwnedPRModel" class, which comes with an owner out of the box. It simplified things and allowed us to use one authorizer method to check ownership for lots of different object types. In the excitement that ensued, that model was deployed as a base class for nearly every model we had, without the care and diligence that should have been invested. As a result, we ended up with lots of models that had both and "owner" and "user", without a clear distinction. I think we managed to clean a lot of this problem up, but not all of it obviously.

So the answer is that there is no practical difference, and the "user" attribute should probably go away.

@mhrivnak
Copy link
Member Author

mhrivnak commented Nov 8, 2011

Good question about the upload_csv() tests. We have a suite of tests that wasn't part of the open source release, and I don't remember exactly why. Maybe there was some data that needed to be cleaned up before releasing it, and I suspect the CSV tests are in there. I'll take a look for that.

@jc0n
Copy link
Member

jc0n commented Nov 9, 2011

I can go ahead and clean up the model after we have sufficient tests for this stuff. Let me know whether they will/can be released.

Also, to clarify, this issue is about creating the necessary upload facility Utils.upload_xml(), like Utils.upload_csv()?

If we have multiple supported file formats I think we should generalize the upload mechanism and wrap it with routines for the specific types. It seems there is little code which is specific to CSV files in upload_csv().

@mhrivnak
Copy link
Member Author

You are correct. Uploading this sort of file should be fairly generalized, and then how we deserialize it can be use-case-specific.

@jc0n
Copy link
Member

jc0n commented Nov 21, 2011

Looking at this again I don't think that storing files in the database is the right thing to do. It is not a filesystem. It would be more efficient to process the import from the temporary upload file and then discard the file.

If there is another reason for retaining the files, we should store the path to the file and designate a location for it on the filesystem. The current method also assumes (without actually checking so far as I can tell) a small bound on filesize, passing the entire contents around in memory.

@mhrivnak
Copy link
Member Author

I think it would be great to have a view to which you can POST the file, passing an AuthToken and other required fields, that will just take care of the whole process.

In the past I think we've put AuthTokens in the URL, but that's probably not a good idea for the same reasons we don't put passwords in URLs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants