persvr / pintura Goto Github PK
View Code? Open in Web Editor NEWPintura is the JSGI-based RESTful JSON/JavaScript server middleware stack that provides the web interface for the Persevere 2.0 framework
Home Page: http://www.persvr.org/
Pintura is the JSGI-based RESTful JSON/JavaScript server middleware stack that provides the web interface for the Persevere 2.0 framework
Home Page: http://www.persvr.org/
When trying to throw an AccessError, I ran into a problem at
https://github.com/persvr/pintura/blob/master/jsgi/error.js#L24
Basically, e instanceof AccessError is always false. I'm wondering if it is because they don't come from the same physical file. I load require("perstore/errors").AccessErrors which pulls in ./node_modules/perstore/errors.js. However, pintura's jsgi module, which uses the same require, loads ./node_modules/pintura/node_modules/perstore/errors.js . This ends up causing the instanceof operator to fail.
For now I've worked around this issue by changing the check to be:
if (e instanceof AccessError || (e.name && e.name=="AccessError"))
Which seems to do the trick for me for now, but perhaps there is a better way to fix this issue?
jsgi/routes can take a customRoutes
config array. i'm not sure what the elements of that array should look like but 2 obvious choices are:
declare
r
variable used in declare
.however the way in which the elements are added won't work no matter what the elements are. also, if you provide null
or undefined
as the customRoutes
then an error occurs because it's assumed to always be an array. i couldn't decide which way to fix this
customRoutes
?customRoutes
be an array of r
-like objects and then avoid calling declare
and just push them onto routes
?customRoutes
be an array of arrays so that for each element we call declare.apply(null, customRoutes[ i ]);
?--Vladimir
i just realized why the opening write('[')
was outside the forEach... if the array has a length of 0 it will be wrong. i should have a fix for it tomorrow.
don't work:
Error: TypeError: Cannot read property 'length' of undefined
at Object.forEach (jar:http://github.com/kriszyp/pintura/zipball/master!/lib/media/csv.js:18:29)
at handle (jar:http://github.com/kriszyp/jsgi-node/zipball/master!/lib/jsgi-node.js:139:33)
at notify (/home/dvv/IRC/nodules/lib/nodules-utils/promise.js:147:27)
at notifyAll (/home/dvv/IRC/nodules/lib/nodules-utils/promise.js:136:7)
at [object Object]. (/home/dvv/IRC/nodules/lib/nodules-utils/promise.js:176:5)
at jar:http://github.com/kriszyp/pintura/zipball/master!/lib/jsgi/cascade.js:19:28
at notify (/home/dvv/IRC/nodules/lib/nodules-utils/promise.js:147:27)
at notifyAll (/home/dvv/IRC/nodules/lib/nodules-utils/promise.js:136:7)
at [object Object]. (/home/dvv/IRC/nodules/lib/nodules-utils/promise.js:176:5)
at notify (/home/dvv/IRC/nodules/lib/nodules-utils/promise.js:152:29)
Array.prototype.toString is not generic
-- Vladimir
What is the default behavior when a (link with a) URI template is resolved, but the property that will be replaced in the URI is undefined?
Recent changes to jsgi/static broke static content handling completely.
The response is never returned.
The posix module has been renamed fs in the latest node (http://groups.google.com/group/nodejs/browse_thread/thread/97e0057fc59eeb08)
These commits change the references in the packages used by pintura:
http://github.com/smith/jsgi-node/commit/a8633b1e5d4c4879aa368d68ffdc6a36b35e48c7
http://github.com/smith/perstore/commit/aaaeba3d4e1799d019aa821b165960134e89be30
http://github.com/smith/pintura/tree/8257adc0c4cb09c1f690849f3ae678a0abd01534
When the Session file gets too large, persvr will hang with a "RangeError: Maximum call stack size exceeded"
When trying to throw an AccessError, I ran into a problem at
https://github.com/persvr/pintura/blob/master/jsgi/error.js#L24
Basically, e instanceof AccessError is always false. I'm wondering if it is because they don't come from the same physical file. I load require("perstore/errors").AccessErrors which pulls in ./node_modules/perstore/errors.js. However, pintura's jsgi module, which uses the same require, loads ./node_modules/pintura/node_modules/perstore/errors.js . This ends up causing the instanceof operator to fail.
For now I've worked around this issue by changing the check to be:
if (e instanceof AccessError || (e.name && e.name=="AccessError"))
Which seems to do the trick for me for now, but perhaps there is a better way to fix this issue?
I'm testing pintura and I started from persevere-example-wiki where I'm using the MySQL store to load a list of items into a dgrid (that uses Pagination extension and dojo/store/JsonRest as store).
The visible effect is that the dgrid shows "1 - 1 of 0" in the footer and when you try to navigate to next page it will get all the products.
The headers are returned correctly by pintura but the JsonRest refuses to use content-range and gives error that is an unsafe header.
To make it work I added the following code into pintura/jsgi/rest-store.js after line 122:
if (request.crossSite) { headers["access-control-expose-headers"] = "content-range"; }
I'm not sure this is the best place to solve it, maybe it can be added in xsite.js but that's why I submited this issue before makeing a PR.
many of the other packages that make up persevere (pintura) are published to npm. perstore and pintura seem to be the only exceptions.
I was wondering what a good standard approach would be to discovering if a model / item is writable. There are good reasons not to use OPTIONS for this (currently that just returns all available methods), and obviously one could implement a method, but a meta URI would probably best fit the HTTPWG approach.
Any ideas?
If I run the example wiki using rhino/narwhal by executing:
persvr example
it works fine. however, when i modify the page.js file to attempt to use either the SQL store or the Mongo store, i get errors.
SQL gives me this error:
TypeError: [JavaPackage org.persvr.store.SQLStore] is not a function, it is object
Mongo gives me this error:
Error: undefined failed to load file://...\example/lib/sys.js
All I have done is modify the page.js file by uncommenting the appropriate section to change the pageStore that is used...
I also get this error when I run the page through the browser:
"Error: You must assign a getDataModel method to the pintura config object in order to expose data"
How can I POST data to datastore cross-domain? I have my webapp running on 127.0.0.1/app.html and Pintura is running on 127.0.0.1:8080. I can authenticate and get pintura-session cookie but I can't get POST to work. I have tried to put Client-Id with pintura-session string but no luck, I'm still getting 405 error.
due to the subj has changed some files locations package.json should map
"narwhal-lib/": "jar:http://github.com/kriskowal/narwhal-lib/zipball/master!/lib/narwhal/"
-- Vladimir
When I'm trying to query model with Dojo's Datastore, I get 'ReferenceError: callAsync is not defined'. I'm using MongoDB. Pure HTTP REST GET call works but for some reason it breaks with Dojo. Is this a bug or am I missing some dependency?
Break line is 319 in mongodb.js and it basically calls 'when(callAsync(collection.count, [search]), function(totalCount){'.I have promissed-io in the mappings so when() should work properly.
I discovered it while working with a dgrid that uses the Pagination extension, a JsonRest store and on server side a mysql-store on an empty table.
The returned header is:
content-range: items 0--1/*
The observed effect is that dgrid displays on footer "Nan - Nan of NaN results".
The code that creates the header is on lines 117 - 118 of persvr/pintura/jsgi/rest-store.js:
var end = start + (responseValue.length || 0) - 1;
headers["content-range"] = "items " + start + '-' + end + '/' + (count || '*');
At first I though is because on line 117, when start is 0 and responseValue.length is also 0 the result in end will be -1. Even though end should be 0 it didn't caused the dgrid problem.
The problem is the * returned as the count value on 118 line because in dojo/store/JsonRest.js at line 220
return range && (range = range.match(/\/(.*)/)) && +range[1];
it is returned +(the-count-value) and +('*') is Nan.
I tested with Chrome 36 and Firefox 30 and the dgrid & dojo are last code from master.
My quick solution was to replace (count || '*') with (count || '0') in the line 117 but I'm not sure how correct that is.
Virgil
Restrictive is required twice in security. Is this intentional?
pintura stopped to recognize "multipart.js" -- it searches for it in my app/lib/
error: http://pastie.org/946724
1.92 works fine
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.