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

new validation functions #21

Merged
merged 1 commit into from Feb 4, 2014
Merged

Conversation

dismantl
Copy link

@seamustuohy
Copy link
Contributor

Code reviewed by s2e. Ready for functional testing.

@seamustuohy
Copy link
Contributor

App_catagory Validate function failed with the following error when submitting an application:

/usr/lib/lua/luci/dispatcher.lua:448: Failed to execute call dispatcher target for entry '/admin/commotion/apps/add_submit'.
The called action terminated with an exception:
/usr/lib/lua/luci/commotion/validate.lua:114: attempt to index global 'luci' (a nil value)
stack traceback:
    [C]: in function 'assert'
    /usr/lib/lua/luci/dispatcher.lua:448: in function 'dispatch'
    /usr/lib/lua/luci/dispatcher.lua:195: in function </usr/lib/lua/luci/dispatcher.lua:194>

To fix this I changed line 114 of /usr/lib/lua/luci/commotion/validate.lua to reference the existing uci cursor instead of attempting to use the globaly scoped luci.model.uci function which does not exist in a modules not using package.seeall:

- local _uci = luci.model.uci.cursor()
+ local _uci = uci.cursor()

After this change I encountered the following error upon resubmitting the same application.

/usr/lib/lua/luci/dispatcher.lua:448: Failed to execute call dispatcher target for entry '/admin/commotion/apps/add_submit'.
The called action terminated with an exception:
/usr/lib/lua/luci/commotion/validate.lua:116: attempt to call global 'type' (a nil value)
stack traceback:
    [C]: in function 'assert'
    /usr/lib/lua/luci/dispatcher.lua:448: in function 'dispatch'
    /usr/lib/lua/luci/dispatcher.lua:195: in function </usr/lib/lua/luci/dispatcher.lua:194>

Adding the following line before the "local validate = {}" call addressed this error. Again, it was a stock function not carried forward into the local sandbox of the module.

local type = type                                                                   

seamustuohy pushed a commit that referenced this pull request Feb 4, 2014
…ull-3

Branch tested and ready for merging.
@seamustuohy seamustuohy merged commit 66d6d07 into master Feb 4, 2014
@seamustuohy
Copy link
Contributor

FIRST BUG : /usr/lib/lua/luci/commotion/validate.lua:114: attempt to index global 'luci' (a nil value) = FIXED!

SECOND BUG: /usr/lib/lua/luci/commotion/validate.lua:116: attempt to call global 'type' (a nil value) = FIXED!

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

Successfully merging this pull request may close these issues.

None yet

2 participants