-
Notifications
You must be signed in to change notification settings - Fork 2
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
Comments
Also, look in pr_services.exam_system.tests to see how XML upload is currently done and to obtain a sample XML file. |
This isn't directly related but what is the difference between |
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. |
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. |
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. |
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(). |
You are correct. Uploading this sort of file should be fairly generalized, and then how we deserialize it can be use-case-specific. |
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. |
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. |
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()
The text was updated successfully, but these errors were encountered: