Error when creating questions with a new custom question type

Error when creating questions with a new custom question type

by James Bryan -
Number of replies: 3

Hi Everyone, 

I have been using the C# question type as provided here: http://coderunner.org.nz/mod/forum/discuss.php?d=79

using the steps to create a question type here: http://coderunner.org.nz/mod/book/view.php?id=193&chapterid=749


However, I am running into the issue where I can save the new question type and have it displayed in the question types dropdown, however, if I go to create a new question with the custom question type I get the error: 

"Error loading prototype: Error fetching prototype. qtype_coderunner/Prototype DEMO_C_VIA_PYTHON is unavailable in this context, or does not exist."

The original question I created the question type for, works perfectly, however I can not create any more questions using the question type.

If any more information is required, please ask.

Thank you.

Regards

James

In reply to James Bryan

Re: Error when creating questions with a new custom question type

by Martin Zwerschke -

I had this issue as well but it was only a matter of renaming the prototype.

It somehow depended on the right timing of renaming and using the prototype.

I got this working after some trying but can not remember the steps I followed to solve that naming conflict.

In reply to Martin Zwerschke

Re: Error when creating questions with a new custom question type

by Richard Lobb -

This sounds like it might the bug that I became aware of earlier this week via another forum posting: you can create question types with names containing any characters you like but when you try to use them, non-alphanumeric characters are filtered out of the requested type name. This results in "Error fetching prototype." 

So perhaps try a type name like 'csharp_function' rather than 'c#_function'?

The fix I have in my development system is to constrain question types to be alphanumeric when you first create the prototype, but I'm starting to wonder if I shouldn't instead allow arbitrary white-space trimmed strings. 

Richard

In reply to Richard Lobb

Re: Error when creating questions with a new custom question type

by James Bryan -
This was indeed the issue.


Thank you