Dragonfly - a web framework for newLISP
Re: Dragonfly - a web framework for newLISP
Congratulations! Is this the official link to the Dragonfly docs?
http://www.taoeffect.com/dragonfly-newl ... gonfly_api
let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
http://www.taoeffect.com/dragonfly-newl ... gonfly_api
let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
Re: Dragonfly - a web framework for newLISP
That's just my personal testing ground for Dragonfly with Apache, the official link will be on the rundragonfly site once 0.50 is released:Lutz wrote:Congratulations! Is this the official link to the Dragonfly docs?
http://www.taoeffect.com/dragonfly-newl ... gonfly_api
http://www.rundragonfly.com/dragonfly_api
That site isn't up-to-date as of this posting though.
Definitely! :-)let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
I think 0.50 should be around the corner very soon, the core I think is done and so is the User's Guide. Here's a link to the first page:
http://www.taoeffect.com/dragonfly-newl ... ly_welcome
Get your Objective newLISP groove on.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
Each of those URLs is (when stripped of the domain name) the ID of an entry in a database. It made sense to me to have a single 'design' or template which was then applied to the information when extracted from the database. I'll have another look at the documents and work out how to do it the new way.itistoday wrote:it seems like creating a page for each of those is the solution you're looking for [...]
... I'd consider splitting all of your pages into separate files
Re: Dragonfly - a web framework for newLISP
Ah! Gotcha, sorry, I didn't know that's what you were doing, and my sincere apologies if you mentioned it (I must have missed that part *whoops*).cormullion wrote:Each of those URLs is (when stripped of the domain name) the ID of an entry in a database. It made sense to me to have a single 'design' or template which was then applied to the information when extracted from the database. I'll have another look at the documents and work out how to do it the new way.
In that case then a custom-route is the way to go, and yours should be extremely simple. For info on how to create a route (as well as an example) see this page:
http://www.taoeffect.com/dragonfly-newl ... ate_routes
Or once it's updated, the official page:
http://www.rundragonfly.com/dragonfly_create_routes
If you're not going to be using the other routes you can disable them, or place yours at the head of the 'dragonfly-routes' list so that it's evaluated first (for efficiency).
Get your Objective newLISP groove on.
Re: Dragonfly - a web framework for newLISP
The official Dragonfly docs are here now: http://www.rundragonfly.com/dragonfly-api/index.htmlLutz wrote:Congratulations! Is this the official link to the Dragonfly docs?
http://www.taoeffect.com/dragonfly-newl ... gonfly_api
let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
Or in our site design: http://www.rundragonfly.com/dragonfly_api
Cheers
Marc
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de
http://dragonfly.apptruck.de
Re: Dragonfly - a web framework for newLISP
... Dragonfly docs-index and site are now also accessible from here:
http://www.newlisp.org/modules/
and here:
http://www.newlisp.org/index.cgi?Code_Contributions
Not sure if the home page links for the authors Marc and Greg are correct on that last page.
Ps: The http://www.newlisp.org/code/modules/sqlite3.lsp.html module and help page has also been updated again.
http://www.newlisp.org/modules/
and here:
http://www.newlisp.org/index.cgi?Code_Contributions
Not sure if the home page links for the authors Marc and Greg are correct on that last page.
Ps: The http://www.newlisp.org/code/modules/sqlite3.lsp.html module and help page has also been updated again.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
I've nearly got my site working on Dragonfly 0.50. It's just me being slow - it's like waking up and finding that someone's moved all the furniture... :)
I can't quite work out one thing - how to make the forms work. For example, in the old version, I had this sort of thing for 'search':
where the "/search/for" got translated somehow, and the template called 'search' was loaded; the search string was obtained by
My mind's now gone blank and I can't work out how to set this up in a completely different way.
I have many questions - but first i want to say "awesome job" for all this cool stuff!
I can't quite work out one thing - how to make the forms work. For example, in the old version, I had this sort of thing for 'search':
Code: Select all
<div class="form">
<form id="search" action="/search/for" method="POST" />
<p>
<input type="text" class="input" name="inputstring" size="8" value="" />
<input type="submit" name="search" value="Search">
</p>
</form>
</div>
Code: Select all
<% (set 'search-text (lookup "inputstring" Web:POST)) %>
I have many questions - but first i want to say "awesome job" for all this cool stuff!
Re: Dragonfly - a web framework for newLISP
Hi Cormullion!
Great to hear You're working with the new Dragon :)
The POST variables can be accessed like this for Your form.
Hope this helps!
Cheers
Hilti
Example with form:
Great to hear You're working with the new Dragon :)
The POST variables can be accessed like this for Your form.
Code: Select all
<% (print ($POST "inputstring")) %>
Cheers
Hilti
Example with form:
Code: Select all
<div class="form">
<form id="search" action="" method="POST" />
<p>
<input type="text" class="input" name="inputstring" size="8" value="" />
<input type="submit" name="search" value="Search">
</p>
</form>
</div>
<p>
<% (print ($POST "inputstring")) %>
</p>
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de
http://dragonfly.apptruck.de
Re: Dragonfly - a web framework for newLISP
I'm quite impressed the site! It's very clean and simple to navigate and understand. The Getting Started walk-though made sense and should make it easy for people to get started.
I've never done any serious web development, but if ever I did, Dragonfly would be a serious contender for my api. It has that very accessible bar of entry, just like newLISP does.
I've never done any serious web development, but if ever I did, Dragonfly would be a serious contender for my api. It has that very accessible bar of entry, just like newLISP does.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
Yes, thanks! That's nice and easy.hilti wrote:Hope this helps!
I'm now running Dragonfly 0.50 at http://unbalanced-parentheses.nfshost.com/, and it's working quite well. There's a long list of things to do though.. :)
What's the best way to do Atom/Rss? I've got the code to provide the information, not sure about the routes...
How do you set the title of a page? Looks like the function call in header or something...
Code: Select all
<title><% (title) %></title>
Anyway, thanks again to Team Dragonfly!
Re: Dragonfly - a web framework for newLISP
If you're serving a static file for your feed then you can just add its extension to the STATIC_TRIGGER_EXTENSIONS in the config.lsp.cormullion wrote:What's the best way to do Atom/Rss? I've got the code to provide the information, not sure about the routes...
You're probably generating it on-the-fly though, so that's probably not what you want.
Instead just make a view (i.e. /feed) and place your newLISP code that outputs your Atom/RSS feed in it. Make sure to set the proper MIME-type though somewhere in there. I.e. place a call like this in your feed view somewhere:
Code: Select all
(Response:content-type Response:xml-type)
Code: Select all
(Response:content-type "application/atom+xml")
That function is from the example-site, it's defined in plugins-active/dragonfly_basic.lsp and uses the symbol DF:viewname (which is set by the STATIC_TRANSFORMATIONS in config.lsp).How do you set the title of a page? Looks like the function call in header or something...
Code: Select all
<title><% (title) %></title>
newLISP doesn't support the .htaccess redirection that apache does (see the explanation in the Getting Started part of the User Guide), and Dragonfly uses the QUERY_STRING to determine which view/resource is being accessed.Also, I'm puzzled by how the question mark in the URL routes (eg "?welcome") disappears when I'm using Apache, but appears when using newLISP server. Why is that? It's making the search fall over but it works locally using newLISP server...
However, I've just added functionality to the mercurial repository that removes the need for the ? even when using the built-in newLISP server.
For more information, see the comments in this thread: http://newlispfanclub.alh.net/forum/vie ... f=2&t=3168
BTW, when 0.51 is released (or if you're using the latest mercurial), use the newlispServer script to run the newlisp server (as it's no longer as simple as it was). Like this:
Code: Select all
$ cd path/to/example-site
$ ./newlispServer
Get your Objective newLISP groove on.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
Wow, great tech support too! Thanks. I'll try to get this all working today...
By the way, when you update the framework, you won't overwrite all my changes in "plugins-active" will you? :)
By the way, when you update the framework, you won't overwrite all my changes in "plugins-active" will you? :)
Re: Dragonfly - a web framework for newLISP
Nope. As long as you're not modifying the files that come with Dragonfly and are creating your own plugins your changes won't be overwritten and no conflicts should arise.cormullion wrote:By the way, when you update the framework, you won't overwrite all my changes in "plugins-active" will you? :)
Get your Objective newLISP groove on.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
Got most things working OK. One exception: an Atom feed. I'm struggling to make any progress with this - ran out of time for now - but hope to address the problem soon.
As I see it, this is the process that ought to work:
1 user request is for 'atom' - http://blah.com/atom
2 dragonfly converts this to a request to display the view file 'atom.html' in views/ ('html'? - well, your RSS file is 'dragonfly_rssfeed.html' in 'views/'.)
3 the 'atom.html' file generates the XML output:
where the partial files are called head.xml story.xml and foot.xml. (Or should they be 'html'?)
5 the header for the main web page refers to the XML feed using this function:
or does there need to be an 'atom' version of this?
Anyway, apart from this one area I've yet to get to grips with, things are looking good!
As I see it, this is the process that ought to work:
1 user request is for 'atom' - http://blah.com/atom
2 dragonfly converts this to a request to display the view file 'atom.html' in views/ ('html'? - well, your RSS file is 'dragonfly_rssfeed.html' in 'views/'.)
3 the 'atom.html' file generates the XML output:
Code: Select all
<% (Response:content-type "application/atom+xml") %>
<% (Dragonfly:display-partial "head") %>
code to generate XML using partial templates
<% (Dragonfly:display-partial "story") %>
<% (Dragonfly:display-partial "foot") %>
5 the header for the main web page refers to the XML feed using this function:
Code: Select all
(rss "Dragonfly web framework RSS Feed" (web-root "?dragonfly_rssfeed/xml"))
Anyway, apart from this one area I've yet to get to grips with, things are looking good!
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
I found a strange bug relating to the nldb database code... I'm using a revised version of nldb.lsp in plugins-active, but don't know whether you want to add it - or let me add it someday...
Re: Dragonfly - a web framework for newLISP
.html if the VIEW_EXTENSION is .html.cormullion wrote:2 dragonfly converts this to a request to display the view file 'atom.html' in views/ ('html'? - well, your RSS file is 'dragonfly_rssfeed.html' in 'views/'.)
Not really, I'm not sure why you're outputting the head/story/footer as you're not displaying an HTML document but an RSS/Atom feed.3 the 'atom.html' file generates the XML output:Code: Select all
<% (Response:content-type "application/atom+xml") %> <% (Dragonfly:display-partial "head") %> code to generate XML using partial templates <% (Dragonfly:display-partial "story") %> <% (Dragonfly:display-partial "foot") %>
Check the docs for VIEW_EXTENSION. It's also documented via comments in config.lsp.where the partial files are called head.xml story.xml and foot.xml. (Or should they be 'html'?)
If VIEW_EXTENSION is .html, they should be .html if you're using the display-partial/display-view functions. Use display-file/include if you want to avoid the use of VIEW_EXTENSION. See the Dragonfly API for details.
Hmm... that's actually outdated (from pre-0.50), I'll fix that. 'web-root' should not have the ? specified in the string and there's no need for the "/xml" after "dragonfly_rssfeed".5 the header for the main web page refers to the XML feed using this function:
Code: Select all
(rss "Dragonfly web framework RSS Feed" (web-root "?dragonfly_rssfeed/xml"))
If you want to display an atom feed include the appropriate markup to display atom feeds. I personally don't recommend relying too heavily on Dragonfly's markup-shortcut functions like 'rss', it's just as easy to include the actual HTML markup (check what 'rss' does, it's defined in dragonfly_basic.lsp, it's just a shortcut for the the 'link' tag to include an rss file in the page). If you're confused, check with google.or does there need to be an 'atom' version of this?
Get your Objective newLISP groove on.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
OK, gotcha. I've probably been assuming that I should switch to '.xml' extensions at some stage but sticking with 'html' all the way helps - at least, hitting http://unbalanced-parentheses.nfshost.com/atom seems to want to produce Atom XML.
The head/story/footer stuff is just so that I can output the XML heading stuff (author update etc) and then loop through each of the last x items.
Thanks again for the help!
The head/story/footer stuff is just so that I can output the XML heading stuff (author update etc) and then loop through each of the last x items.
Thanks again for the help!
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
I have one more problem... I'm finding that some pages are being processed through Dragonfly but I didn't think they were going to be (they're not views). For example, if you go to http://unbalanced-parentheses.nfshost.c ... ft.nl.html - it's a page generated by newlispdoc - and click on source, the resulting HTML file is being passed through Dragonfly:eval-template. Unfortunately that file contains text (probably multiple [text][/text] pairs) that causes eval-template to fail. It's not supposed to be a template.
I thought that files came through 'as they were' if they didn't match anything else. I'm wondering whether I've done something that makes Dragonfly try to evaluate all files...
Code: Select all
ERR: missing parenthesis : "...\"'(){}.0123456789[/text])
called from user defined function Dragonfly:eval-template
called from user defined function Route.Static:run
called from user defined function Dragonfly:listener
called from user defined function run
Re: Dragonfly - a web framework for newLISP
cormullion, please take a look at how Route.Static works:
http://www.rundragonfly.com/dragonfly_routes
It will match all files that end in VIEW_EXTENSION, and your source page does as well. Therefore if there are any "code islands" (i.e. stuff that comes after OPEN_TAG: <%) then that will be interpreted as newLISP code and it will be evaluated.
If you don't want that file getting sent through eval-template then there are several things you can do:
- Update your .htaccess file with a RewriteCond to prevent files ending in .src.html from being sent to the index.cgi script. This requires knowledge of .htaccess files (search google for mod_rewrite).
- Do it instead through a custom route that checks if the QUERY_STRING represents one of your source files and then simply pass it through the 'display-file' function. Make sure this route is added to the front of 'DF:dragonfly-routes' so that it gets evaluated before Route.Static.
- Change your VIEW_EXTENSION to something else (and change all your template files as well to that other extension).
In a future version of Dragonfly we could probably add a hook to Route.Static that will allow you to define a function that determines whether the file should be passed through display-view or display-file (as the former sends it through eval-template and the latter doesn't), but for now your easiest solution is to add a custom route, which isn't difficult to do (again, the docs really help you here).
EDIT: Whoops, that's DF:include, not DF:display-file. DF:display-view calls DF:display-file which calls DF:eval-template. Apparently I don't know what my own code does. :-p
http://www.rundragonfly.com/dragonfly_routes
It will match all files that end in VIEW_EXTENSION, and your source page does as well. Therefore if there are any "code islands" (i.e. stuff that comes after OPEN_TAG: <%) then that will be interpreted as newLISP code and it will be evaluated.
If you don't want that file getting sent through eval-template then there are several things you can do:
- Update your .htaccess file with a RewriteCond to prevent files ending in .src.html from being sent to the index.cgi script. This requires knowledge of .htaccess files (search google for mod_rewrite).
- Do it instead through a custom route that checks if the QUERY_STRING represents one of your source files and then simply pass it through the 'display-file' function. Make sure this route is added to the front of 'DF:dragonfly-routes' so that it gets evaluated before Route.Static.
- Change your VIEW_EXTENSION to something else (and change all your template files as well to that other extension).
In a future version of Dragonfly we could probably add a hook to Route.Static that will allow you to define a function that determines whether the file should be passed through display-view or display-file (as the former sends it through eval-template and the latter doesn't), but for now your easiest solution is to add a custom route, which isn't difficult to do (again, the docs really help you here).
EDIT: Whoops, that's DF:include, not DF:display-file. DF:display-view calls DF:display-file which calls DF:eval-template. Apparently I don't know what my own code does. :-p
Last edited by itistoday on Tue Nov 17, 2009 2:17 am, edited 4 times in total.
Get your Objective newLISP groove on.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
OK, thanks! I can solve it by passing it to DF:include... I didn't fully appreciate the fact that every matching file, not just a view file, is passed through eval-template. Makes sense now, though.
I have to admit that I've studied the documents, but still find it hard to solve problems - I'm not a web developer, so I don't have the basics down yet.
I have to admit that I've studied the documents, but still find it hard to solve problems - I'm not a web developer, so I don't have the basics down yet.
Re: Dragonfly - a web framework for newLISP
Ack! Sorry for giving you bad information, I've edited my post to mention that DF:include is what you want, not DF:display-file. You figured it out though. :-)cormullion wrote:OK, thanks! I can solve it by passing it to DF:include... I didn't fully appreciate the fact that every matching file, not just a view file, is passed through eval-template. Makes sense now, though.
Just takes practice, you'll get it. :-)I have to admit that I've studied the documents, but still find it hard to solve problems - I'm not a web developer, so I don't have the basics down yet.
BTW, I *love* your magical rainbow code highlighter stuff.
Get your Objective newLISP groove on.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Dragonfly - a web framework for newLISP
:) I'm still trying to decide whether it's just cool or useful as well!itistoday wrote:BTW, I *love* your magical rainbow code highlighter stuff.
I realized I haven't uploaded the code for that; it's now uploaded as Module Nestor.
Re:
Hi, just noticed the ohloh.net Dragonfly listing still has the old license.hilti wrote: * changed license from MIT to GNU (GPL v3)
http://www.ohloh.net/p/dragonfly-newlisp
Just wanted to let hilti know so he could update it there when he has a chance.
thanks!
Re: Dragonfly - a web framework for newLISP
Changed! :-)
Thanks JoeJoe!
Hilti
Thanks JoeJoe!
Hilti
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de
http://dragonfly.apptruck.de
Re: Dragonfly - a web framework for newLISP
super duper! :D