ocsigen / eliom Goto Github PK
View Code? Open in Web Editor NEWMulti-tier framework for programming web and mobile applications in OCaml.
Home Page: http://eliom.org
License: Other
Multi-tier framework for programming web and mobile applications in OCaml.
Home Page: http://eliom.org
License: Other
I came across this issue after compiling with all warnings activated: when running the latest Eliom master, opening Eliom_content.Html5.F will trigger "Warning 33: unused open Eliom_pervasives". This did not happen until very recently.
While using .eliomi on Cumulus I noticed that there is a serious bug with it.
Because I'm lazy I created the interface file filling with polymorphic types the parameter types I wasn't sure about.
But to my great surprise, the project compiled without giving much details about types.
Then you can pass whatever types you want as parameter.
See here if you want more details: Cumulus/Cumulus@604278a#diff-27a4074beace25a4144a64136ef2aa2aR1
When I submit a form with a non localized file parameter, Eliom doesn't find the service any more; i.e. it returns error 500 and "Wrong Parameters" (visible on the console).
Any idea what's going on?
In a project eliom-distillery -name nofilenl
:
open Eliom_lib
open Eliom_content
module Nofilenl_app =
Eliom_registration.App
(struct let application_name = "nofilenl" end)
let nl_file =
Eliom_parameter.make_non_localized_parameters ~prefix:"prefix" ~name:"name" ~persistent:true
(Eliom_parameter.file "file")
let main_service =
Eliom_service.Http.service ~path:[] ~get_params:Eliom_parameter.unit ()
let service =
Nofilenl_app.register_post_coservice' ~post_params:Eliom_parameter.unit
(fun () () ->
Lwt.return
(Eliom_tools.F.html ~title:"nofilenl"
Html5.F.(body [ pcdata "ok" ])))
let () =
Nofilenl_app.register
~service:main_service
(fun () () ->
Lwt.return
(Eliom_tools.F.html ~title:"nofilenl"
Html5.F.(body [
post_form ~service (fun () -> [
file_input ~name:(Eliom_parameter.get_nl_params_names nl_file) ();
button ~button_type:`Submit [pcdata "ok"]
]) ();
])))
Currently, by default, when an eliom app is made, eliomdep/c/opt are used, which are bytecode versions. Native code versions should be used instead for performance reasons.
coordinates
(TCoord
& TCoordv
) as "native" typeTOption
and TNEOption
Hi,
my eliom program does not compile since I update to the development version.
Is there a function that can easily create Form.form_elt ?
Thanks
Currently, AFAIK, the first argument of eliomdep should be -server or -client.
eliomdep should work with any order of arguments.
Some users wants a template syntax, but IMHO it's not what we want. Instead, we can have (yet) another syntax extension for making the html result more readable.
Here is my proposal for this syntax:
let s = pcdata in
let delete = a ~service:Services.delete_feed [s "delete"] () in
let edit = a ~service:Services.edit_feed [s "edit"] () in
TMPL(s) "($delete | $edit)"
This syntax is PGOCaml-like so it should be doable and it's definitively more readable than (the code produced):
[s "("; delete; s " | "; edit; s ")"]
So this extension is more or less a format-like syntax that produce an html elements list.
The parameter of TMPL is the function used for insert strings (in most cases, it's pcdata).
I have a error during compilation.
File "eliom_content_core.ml", line 232, characters 38-64:
Error: This expression has type
Eliom_xml.event_handler = Eliom_lib.RawXML.event_handler
but an expression was expected of type string
The tutorial (https://ocsigen.org/tutorial/application) and the header of the --help, tell that -destination exists. But it seems not. Instead there is a -target-directory.
This message too much recursion
appeases on client side with the testsuite (at least) on the pages:
I'm planning to do a new syntax extension, using the new extension-point mechanism and following some ideas from Alain Frisch.
The syntax would look like this :
let@sh bla = 3 (* A shared declaration *)
let@s blu = "blu" (* A server declaration *)
let x = ( "blop" )@cval (* A client value *)
[%%client ] (* The beginning of a server section *)
let a = ...
let b = ...
There is something a bit touchy : injections. I havn't study the question enough to have an opinion on it.
I didn't even begin to work on this, and we have quite some time since extension-points just got only merge on the trunck. Any feedback on the syntax and ideas about this would be appreciated.
hopefully, this new syntax should fix some bugs like #18.
This happens on both make test.opt
and make test.byte
. Anyone know what's going on? Thanks!
10:48:05 norml (master)$ make test.opt
mkdir -p local/etc/norml
sed -e "/^ *%%%/d" -e "s|%%PROJECT_NAME%%|norml|g" -e "s|%%DATABASE_NAME%%||g" -e "s|%%DATABASE_USER%%||g" -e "s|%%CMDPIPE%%|%%PREFIX%%var/run/norml-cmd|g" -e "s|%%LOGDIR%%|%%PREFIX%%var/log/norml|g" -e "s|%%DATADIR%%|%%PREFIX%%var/data/norml|g" -e "s|%%PERSISTENT_DATA_BACKEND%%|dbm|g" -e "s|%%LIBDIR%%|%%PREFIX%%var/lib/norml|g" -e "s|%%WARNING%%|DON\'T EDIT THIS FILE! It is generated from norml.conf.in, edit that one, or the variables in Makefile.options|g" -e "s|%%PACKAGES%%||g" -e "s|%%ELIOMSTATICDIR%%|%%PREFIX%%var/www/norml/eliom|g" -e "s|%%DEBUGMODE%%||g" -e "s|%%PORT%%|8080|g" -e "s|%%STATICDIR%%|static|g" -e "s|%%USERGROUP%%||g" norml.conf.in | sed -e "s|%%PREFIX%%|local/|g" > local/etc/norml/norml-test.conf
mkdir -p local/var/data/norml
mkdir -p local/var/lib/norml
mkdir -p local/var/log/norml
mkdir -p local/var/www/norml/static
mkdir -p local/var/www/norml/eliom
mkdir -p local/var/run
js_of_eliom -c norml.eliom
Camlp4: Uncaught exception: DynLoader.Error ("/Users/rob/.opam/4.00.1/lib/deriving-ocsigen/pa_deriving.cma", "interface mismatch on Camlp4_import")
File "norml.eliom", line 1:
Error: Preprocessor error
make: *** [_client/norml.cmo] Error 2
For the moment (AFAIK), only the basic template is tested in the testsuite, the other should be included too.
Hi,
Eliom_service.OCaml does not work on client side.
Unbound Module
In case of mobile application, we need to delare service in shared side. It is due to mobile application which start on client side.
It will be very useful to allow it, because we can not use directly server function.
Before that Eliom changed (Eliom_service.service), we could do it.
We can do it with Unsafe one, I think it is like the old one but I would like to avoid it.
Eliom_service.OCaml
module and Eliom_registration.Ocaml
module should have the same name.
In Eliom_service
it is named OCaml
(with a capitalized 'C') while in Eliom_registration
, it is named Ocaml
(with a non-capitalized 'c').
Here a command to show the difference (in an eliom repository):
$> cat src/server/eliom_service.mli | grep "module OCa" && cat src/server/eliom_registration.mli | grep "module Oca"
module OCaml : "sigs/eliom_service.mli"
module Ocaml : "sigs/eliom_reg_simpl.mli"
I think that it should be named Ocaml
.
and avoid
[> `Attached of
([> `Internal of [> `Service ] ], [> `Get]) a_s ]
Hi,
I have just performed an opam update to get the latest version of eliom and the recompilation of eliom.9999 fails as it does not find js_of_ocaml.tyxml and wikidoc
Regards
Julien
Currently, this piece of code will not work :
let a = ...
{shared{
let bla = {{ ... %a ... }}
}}
You need to write it like this :
let a = ...
{shared{
let bla =
let a = %a in
{{ ... %a ... }}
}}
The problem here is that the syntax extension assume that the %a
in a client value inside a shared section must point to a shared value. The syntax extension then erase the %
when extracting the "client" point of view.
There is several possibility to add the let a = %a
automatically in the current syntax but all of them mess with a legit piece of code. The syntax extension is (mostly) local and it's not reasonable to do a global transformation to catch this kind of piece of code.
In order to do this properly, we would need a type directed syntax extension to detect if a
come from the server or not.
This seems difficult to tackle for now, but may be easier in the future, with the evolution of compiler libs.
Very often some modules are missing in client side programs.
The program fails at startup with a message in the console saying that some closure is not found.
We usually solve this manually by adding ad-hoc references to values from each module in main program.
May be we should try to add option -linkall to the command line generated by js_of_eliom? Does it solve the pb?
archive(byte,javascript) = "+eliom.client/eliom_client.js"
So then we can use ocamlfind
Hello,
In this page: http://ocsigen.org/eliom/manual/server-state that variables with the scope Eliom_common.default_process_scope are identical when they are in the same tab. However it's not the case, and default_process_scope behaves like default_session_scope (all tabs in a single browser).
Here is an example: https://gist.github.com/tobiasBora/bb244fe31570ea82f8e8
And to compile it: http://pastelink.me/dl/b06c4f
Thank you for your work,
Tobias.
To be able to use it in others projects.
It allows the following on client side:
let signal,set_signal = React.S.create "initial title"
let class, set_class = React.S.create "red"
let mydomstring = Html5.R.node (React.map Html5.D.pcdata signal)
let reagular_dom = h1 ~a:[Html5.R.a_class class] R.[ mydomstring ]
let _ = Lwt_js.sleep 2. >>= fun () -> set_signal "new title";set_class "blue"
setting signals will update the dom.
I guess one can implem the server side version of it so that server side changes update the client.
standalone commit : https://github.com/besport/eliom/commit/ece68bb4bb99b040be2b5cc848e3bf8a7caf578b
Hi,
I'm using the a_ontimeupdate
attribute for on the Html5.D.video
tag. But during the page loading, this javascript exception raises :
Uncaught ReferenceError:
caml_closure_idYZ5x5V1X6oZfx8l9tIYSJ4gmAmw41d4d9ece9ab16d3 is not defined
ontimeupdate
But not all the time. Sometimes it's something like :
Uncaught SyntaxError: Unexpected token ILLEGAL
And sometimes there is no exceptions. But in all of those cases, the event handler works just fine. I don't think the error comes from me because I filled the attributes a_onplay
, a_onpause
, etc., in the same way and the exception raises only with a_ontimeupdate
.
Just to check, I tried with Lwt_js_event.make_event
and creating the event from a string with Dom_html.Event.make "timeupdate"
and there is no exception at all.
P.S. : my source code repository is here
Please don't blame me for my dirty code, it's just a try.
It seems it is not possible to use Html5.{F,D}.entity
in client code ; the function works well in server code but maybe produces incorrect HTML when used client-side. I wrote a simple example to illustrate this: https://gist.github.com/pveber/6607134. Normally the page should display a beta and a gamma character, while here only a beta appears. If entity
is replaced by pcdata
on line 22, the code of the gamma character appears below the beta character.
monitoring.ml
unit -> Html5.F.elt
with all those informations.While using the “normal” way of defining services, I got into a wrong argument parsing case.
Starting from a fresh project made with eliom-destillery
, and the following modifications:
let main_service =
Eliom_service.service ~path:[]
~get_params:Eliom_parameter.(
sum
(set string "strings")
(opt (int "left" ** int "right"))
) ()
and
let () =
Test_app.register
~service:main_service
(fun params () ->
Lwt.return
(Eliom_tools.F.html
~title:"test"
~css:[["css";"test.css"]]
Html5.F.(body [
h2 [pcdata "Welcome from Eliom's destillery!"];
a main_service [pcdata "link1"]
(Eliom_parameter.Inj1 ["bouh"; "bah"]);
pcdata ", ";
a main_service [pcdata "link2"]
(Eliom_parameter.Inj2 None);
pcdata ", ";
a main_service [pcdata "link3"]
(Eliom_parameter.Inj2 (Some (42, 42)));
])))
On the generated page the link3
is broken (goes to “Wrong Parameters”).
I'm using Eliom 3.0.3 from Opam (and OCaml 4.01.0).
When compiling using eliomc/eliomopt with pgocaml.syntax it produces the following error:
Camlp4: Uncaught exception: DynLoader.Error ("/home/cyocum/.opam/system/lib/pgocaml/pa_pgsql.cma", "error while linking /home/cyocum/.opam/system/lib/pgocaml/pa_pgsql.cma.\nReference to undefined global `Batteries'")
I have the following installed in opam:
batteries 2.1.0 Community-maintained foundation library
eliom 3.0.3 Framework for programming web sites and client/server web applications
pgocaml 1.7.1 Interface to PostgreSQL databases
I also downgraded to batteries 2.0.0 and I still get the same error.
The new services typing feature doesn't allow to have a fallback service that don't have the same type than the service himself.
For instance, if you have an Appl service and you want to have an Action (Http) service with this service as fallback, the current constraint will reject this (you can bypass this by using the module Unsafe).
This is also rejected for a Http service with an Appl fallback.
What is the expected semantic of fallbacks ? What about caml services ?
Can we conceder allowing this by using [< non_caml_service ] instead of [< http_service ] and [< appl_service ] ?
For consistency with Eliom_registration.Ocaml and because the only official name of the language is OCaml (as decided during an OCaml meeting a few years ago).
There is a weird regression for the typing on injections in the last few commits, and it's the source of this pull request : ocsigen/eliom-widgets#6
Compiling eliom-widget leads to this error message
File "src/ew_editable.eliom", line 45, characters 34-39:
Syntax error: The type of an injected value must not contain any type variable.
Error while running external preprocessor
This was no the case before. I bisected, 71d633a and e1db963 are good, e7cfcee is bad. All the commit in between (1bdb927 0460699 f76931b 96b7132) don't compile/install, so I can't test.
Furthermore, they touch the build system and I have no idea what is going on there.
@balat : you wrote those commits, can you look at this ?
P.S. also, @balat, please read this. You have no idea how happy that would make me. :3
TAny
: encode (string * string) list
TESuffix
: encode string list
the following seams to do something wrong
https://github.com/ocsigen/eliom/blob/master/src/common/eliom_parameter_base.ml#L304
I've tried a simple "Hello World" server-only Eliom module compiled against the latest Ocsigenserver/Eliom development versions (installed via OPAM using the "opamocsigen" repo. Compiler version is 4.01.0). While it does load and run successfully in the bytecode version, trying to run the native code version with ocsigenserver.opt fails with the following error message:
ocsigenserver.opt: main: Fatal - While loading /home/dario/.opam/4.01.0/lib/eliom/server/eliom.cmxs: error loading shared library: /home/dario/.opam/4.01.0/lib/eliom/server/eliom.cmxs: undefined symbol: camlEliom_content
The module's cmxs file was produced using the usual method:
ocamlopt -shared -linkall -I `pwd` -o module.cmxs module.cmx
Is this a known issue?
But not in mli??? :o
this piece of code doesn't compile :
{shared{
let a = ...
let b = {{ a }}
}}
but this one does
{shared{
let a = ...
}}
{shared{
let b = {{ a }}
}}
A short-term solution would be to distribute the shared section along top-level declaration, but I'm sure some other bug like this one lie around.
I'm trying to create a template of a website whose compilation is based on Oasis. With the help of some doc and the Cumulus github page (thank you it's really usefull) I made a first version which can display a page. The problem is that the javascript code isn't launch. In fact I don't even know how to say "please add this library to the JS file" in the oasis file.
If you want to test on the same code as me, is the code I use : https://github.com/tobiasBora/eliom_template_oasis_03.
To run it :
- [Optional] oasis setup
- ./configure
- make
- make run
(This script should copy the js file in the (local) static dir, the problem doesn't come from here.)
And after just open http://localhost:8080/. The basic page is opened, but if you click on "Hello" you are supposed to see an alert message... Which never happened. I have the error
Failure(Client closure 872924384 not found (is the module linked on the client?))As you can see the library isn't linked to the client.
Could you please explain me how I could link the client part of a library to the JS file with Oasis ?
I don't understand it. Now eliom.{server,client}
is a syntax extension ? What is eliom.{server,client}.syntax
then ?
Several use cases for updating elements of a page distinctly exists. In Cumulus for updating either the comment button, the upvote number or even adding a new element or even in xprime (don't know the details).
There is two ways to fix that.
Either maintain elements id on client and look up for update every n seconds.
Or maintain elements id on server side and use Eliom_bus
or Eliom_react
to update the client.
The second way is how does xprime and it needs complicated things like weak tables of buses and so on.
So I wonder if somebody have ideas of how implement that kind of thing properly with eliom ?
PS: Sorry if I've not described well the issue.
We now have PUT and DELETE in ocsigenserver (see here), it would be good to have this in eliom.
I don't know if you're interested in merging this hack. We use it to fake placeholder under ie9. It set the input value with the placeholder when needed.
known isssue:
This patch doesn't do anything when trying to send_the_form/get_value. so you'll send/retrieve the value of the placeholder when the input is not set.
One could check for the classname placeholder_class_hack
to decide whether to send the empty string or the actual value. This could be done before sending a form or when using Manip.get_value (this function doesn't exist yet)
https://github.com/besport/eliom/commit/27aa578157aa1005ff1c0d17aa1222b28db2e818
see https://github.com/hhugo/reactiveData
use case:
module RL = ReactiveData.RList
let r_data, handle = RLmake []
let r_desc = RL.map (fun data ->
Printf.sprintf "name: %s ; value: %s" data.name data.value)
r_data
let r_li = RL.map (fun desc -> li [ pcdata desc]) r_desc
let elt = R.ul r_li
let () =
(* append data to the reactive list *)
RL.append handle {name="name1";value="value1"};
....
(* remove data at position i *)
RL.remove i handle;
(* swap to elements *)
RL.swap i j handle
....
interface : https://github.com/hhugo/reactiveData/blob/master/src/reactiveData.mli
add +classlist.js
to js_of_ocaml command line to add support of classname under ie9 (see ocsigen/js_of_ocaml@7266fb3)
what about adding an option/configuration to add ie9 support (ie: #11)
at least for eliomdoc
henry@ocsigen-s1:/tmp$ ls -l /tmp/eliomdoc* | wc -l
14947
henry@ocsigen-s1:/tmp$ ls -l /tmp/camlpp* | wc -l
3532
I have the error
ocsigenserver.opt: main: Fatal - While loading /home/vb/.opam/4.01.0/lib/eliom/server/eliom.cmxs: error loading shared library: /home/vb/.opam/4.01.0/lib/eliom/server/eliom.cmxs: undefined symbol: camlEliom_content_core
when trying to compile my application (make test.opt)
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.