-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Pure-python alternative to simplates #27
Comments
Before we had the There may be enough value in additional filetypes than simplates to warrant making that part of the system pluggable. See also: Python Server Pages. |
Those are templates, like PHP files, right? They can't contain multiple pages like simplates and my proposal above can. |
Sure, but 0, 1, ∞. If we're supporting a second option, then the task is to make the system pluggable, to support N options. |
That was already part of AspenWeb/salon#13. |
Well, not necessarily. We factored out the algorithm.py library, but the part of Pando that uses the algorithm.py library isn't pluggable. |
@Changaco What I don't like about your proposal is the In the past, we've toyed with the idea of splitting simplate pages out into a directory. I don't like that because it overrides what a directory means in URL-space (and what would the files inside the directory be named?
Let's say that:
So far, so good. Now, let's say that if you hit http://example.com/foo.py you'd get 404. However, every request for Waddya think? :) |
I should also add that |
So on a project you'd configure your editor to highlight files according to the renderer configured for the project (Jinja2 for |
A security risk is that if you publish the publishing root with Apache or Nginx, you leak the source code. If there's a |
Simplates are Aspen's Achilles heal. Filesystem dispatch is compelling. Multi-mode files are a liability. |
Where did I suggest that? 😕
Mixed-mode files are only a problem because of stupid tools and lack of standardization (for example I'm not aware of a PEP specifying how to tag a python string as containing a specific media type or language, maybe we should write one). I'm not sure fleeing the problem is a good solution: are you also going to stop using SQL in gratipay's python code because it's mixing two languages in one file?
Routing Overall your proposal seems pretty compatible with mine. Either:
They're also an asset: less time spent switching between files. |
Up at "you need to modify the python one," and also in your subsequent paragraph about "stupid tools and lack of standardization." ;-)
Instead? I see this as routing to Overnight I've come to think that we should include the renderer in the filename—
One either switches between files, or between locations in a single file. Having the files all right next to each other in the same directory at least makes opening them all at once easier. The question is whether the benefit of having them in the same file outweighs the cost of fighting against "stupid tools and lack of standardization." There's no shortage of work in the world. After nine years, I for one am ready to work on other things besides building an ecosystem around multi-mode files. ;-) |
That's not really more difficult than creating one for simplates. I was comparing simplates to python files containing a
The current dispatcher will pick the latter first. This property is used in Gratipay/Liberapay to serve compiled assets. Another dispatch dilemma we haven't considered yet is what to do when there's both a
As I said, even if we gave up simplates and the
So you want to abandon simplates? |
Regarding mixed-mode files, I also want to point out that they are in fact very common, for example here's some HTML with CSS inside: <h1>Lorem ipsum</h1>
<style>h1 {font-size: 20px;}</style> As you can see GitHub highlights the CSS by default, and so does my text editor, because it's common and standard to embed CSS in HTML. |
(GitHub even respects the <script type="application/javascript">this.is("javascript");</script>
<script type="text/foobar">this is not javascript</script> My editor doesn't. 😞 ) |
Fair enough. It seems that there is some ecosystem support for mixed-mode files for common cases, and little support for uncommon cases.
Quite possibly! I I've started #30 to explore this further and see if it's at all doable before 1.0. 😁 |
This comment was marked as outdated.
This comment was marked as outdated.
Cool. I don't think we should try to make any more progress on this before 1.0, however (that's why I cut off #30 early). |
Adding support for pure-python (
.py
) dynamic resources, in addition to simplates, could be a solution to several issues. Here's what it could look like:Notes:
@whit537 What do you think? Why did you originally go with a custom file format? Is there some issue with using pure python that I missed/forgot?
The text was updated successfully, but these errors were encountered: