piranha | High performance scripting and specification language
kandi X-RAY | piranha Summary
kandi X-RAY | piranha Summary
Piranha is an open-source scripting framework currently under development. It is a reusable framework which allows developers to quickly write scripting interfaces to native C++ libraries. Piranha is currently used as an SDL (scene description language) for the MantaRay ray-tracer. For syntax highlighting in Visual Studio Code check out the Piranha Visual Studio Code Extension. To get started, check out the introductory handbook: Piranha Handbook. Example Piranha compiler implementation: Hello World Piranha Compiler.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of piranha
piranha Key Features
piranha Examples and Code Snippets
Community Discussions
Trending Discussions on piranha
QUESTION
I am trying to add some items to the piranha sitemap using the delegate method OnGenerateSitemaps.
In this method I am calling to a service that gets data from entity framework context and then caches it. Whenever I try to use this service in the delegate-method I get a error that the dbContext has already been disposed.
System.AggregateException: 'One or more errors occurred. (Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
I've tried making the service sync instead of async, I've tried awaiting the result and running the task sync, none of which works.
Any ideas on how to use my service in this delegate in Configure on startup?
...ANSWER
Answered 2021-Jan-08 at 15:28We're (the Piranha team) planning on redesigning the hook system in version 10 (has to be a major version as it will break backwards compatibility) to provide DI functionality in all hooks. However in the meantime the following should fix your issues.
QUESTION
Very new to Piranha and Vue, but not to .Net Core. Trying to get my arms around how to create custom blocks. I've created a new block, attempting to marry the HtmlBlock and ImageBlock:
...ANSWER
Answered 2020-Nov-30 at 18:28Just in case this helps someone. Turns out I did a poor job merging the two blocks together. Chalk this one up to inexperience with both Piranha and Vue.js. I was mixing the code from the docs with the code in the repo. Don't do that - the docs are understandably still a bit behind. I'm not throwing stones at the developers, I really dig what they've created and will continue to put forth the effort to use it proficiently.
Below is what I came up with for the Vue component. There are probably still a few tweaks to be made to separate the Image-Block and Html-Block code better, but it now works, saves, and does not throw errors in the console.
QUESTION
I created a new custom Block and wanted to inject an IOptionsSnapshot to read my appsettings.json values. The problem is that I get an error saying there is no parameterless constructor for my custom block.
Is there a way to somehow do this injection or is this a limitation in Piranha and custom blocks.
...ANSWER
Answered 2020-Oct-15 at 14:21At the moment neither Fields
or Blocks
supports parameter injection into the constructor, however Fields
have two initialization methods that both supports parameter injection, Init()
and InitManager()
. Given how models are constructed the easiest solution would probably be to add the corresponding init methods to Blocks
as well.
Feel free to open an issue/feature request at the GitHub repo https://github.com/PiranhaCMS/piranha.core and we can take the discussion from there!
Best regards
Håkan
QUESTION
Modifying Piranha for 'headless' scenario: I separated the api into its own REST API, and the MVC into its own UI that calls the REST API. Mostly it works well, but now an obstacle. My REST API serializes the result from the Piranha api, and my MVC web deserializes it into a Piranha StandardPage type. This works for all fields except Media, which is always null. Using newtonsoft.Json.
The Media property is defined in Piranha.Extend.Fields.MediaFieldBase with internal set, which explains why I can't deserialize into it. So I added a [JsonProperty] attribute to the Media property. Once I did this, then the Media field was correctly deserialized by the MVC, and images appeared.
But then I found this broke something else: in the manager, when I try to save a page with a Hero image, the Save buttons spins, stops as though it succeeded, but the toast never appears saying success. I set Debug logging for Microsoft.AspNetCore.Mvc.Infrastructure, and see there's a model state error when this happens:
...ANSWER
Answered 2020-May-21 at 14:00I posted this on the Piranha CMS github and one of its authors, Hakan Edling, answered in just a few hours:
"The root issue is that when a new item is selected in the manager in the media picker, the media model that is assigned contains a formatted string size "xxx kb". When ASP.NET tries to deserialize this into a long it fails. So changing the following line in the .vue components for the media-based fields:
QUESTION
So I have been learning Piranha CMS for .Net Core 3.1.
Having read the docs and studied the template I have hit a bit of wall in getting the information from within Blocks to display on the page correctly.
In the Razor Blog Template on the Page.cs the developer has used the below code to display the Blocks that the page has on screen
...ANSWER
Answered 2020-May-14 at 06:36I've answered in the Gitter chat, but I'll answer here as well if someone else has the same question.
Display templates & Editor templatesThe templating system is a built in feature of ASP.NET Core
and assumes you have the following folders present in you project.
QUESTION
ANSWER
Answered 2020-May-13 at 10:16It seems like the identity is missing from your video token, you should have:
QUESTION
What is the best practice for supporting user account registration and sign-in for website (customer) users and also supporting a cms user accounts / admin logins using separate user identity service for both site and cms in the same project?
In order to evaluate how this scenario might work i have have built a test mvc .net core 3.1 website project that utilizes Piranha CMS which in turn uses the user identity service to manage authentication for access to the cms admin panel, couple this with the mvc site also supporting user identity for individual accounts for website customer/users to register/ sign-in.
The following is an example of the startup class ConfigureServices method to illustrate setup of both a cms and website using the user identity service, this currently errors on startup with a message - System.InvalidOperationException: 'Scheme already exists: Identity.Application'
...ANSWER
Answered 2020-Apr-29 at 21:32The user management is totally abstracted in Piranha, so you could actually authenticate the CMS users any way you want. The Identity package that is included in the templates are included as a boilerplate as most users what a single security setup based on ASP.NET Identity. The only thing the manager cares about when signing in is:
- That it finds a registered service implementing
Piranha.ISecurity
(https://github.com/PiranhaCMS/piranha.core/blob/master/core/Piranha/ISecurity.cs) - That the users gets the adequate claims needed after signing in (https://piranhacms.org/docs/architecture/authentication)
The code provided in the templates just sets up the standard Identity settings, but you can override everything to do what you're like. The method UseIdentityWithSeed
can actually take two more parameters for configuring both IdentityOptions
and CookieOptions
to work in any way. Take a look at this page for reference:
https://piranhacms.org/docs/architecture/authentication/identity
User accounts in PiranhaIf you're only looking to adding end-user accounts somewhere this can be done in Piranha CMS by setting up new roles in the admin and adding the application policies you want. You can read about this here:
https://piranhacms.org/docs/tutorials/securing-pages
More guidance on multiple authentication schemesI have never actually deployed a site with this setup, but as always I know someone has :) This issue on GitHub talks about just this, and the setup was successful. As I can't give specific guidance on this scenario, maybe reaching out to the user in this thread can give you what you need!
https://github.com/PiranhaCMS/piranha.core/issues/627
While not being an answer, I hope this will give your what you need to find the answers.
Best regards
QUESTION
I'm using Piranha cms in one of my projects.
I'm looking for a solution to automatically add all my page types to page Type Builder.
At this moment my startup Configure method look like this:
...ANSWER
Answered 2020-Apr-10 at 05:14Yes! If you have an up-to-date version of Piranha you can now do the following.
QUESTION
I'm tasked to provide the excellent Piranha CMS through an API that other UI projects will consume. Piranha docs say it's designed to run "headless" for this purpose, but not many details on how.
I've got the Piranha.WebApi project running, and it serves JSON content of pages as I expect. Currently, it works only when I access it from a browser, because any call to the WebApi prompts for credentials. Once I sign in, the WebApi calls succeed and I can make multiple calls from the same browser.
Now I need to know how other UI code projects can authenticate when calling the WebApi so they can get results.
I've reviewed the links I could find; no good hints yet:
- https://piranhacms.org/blog/techniques-for-securing-pages
- https://github.com/PiranhaCMS/piranha.core/issues/841
- https://github.com/PiranhaCMS/piranha.core/issues/546
Any suggestions will be very helpful!
...ANSWER
Answered 2020-Apr-08 at 06:46The package Piranha.WebApi
uses claims to verify the caller, but how these claims actually get assigned to the user is up to you. The default security implementation Piranha.AspNetCore.Identity
by default configures cookie-based security, but if you're only using your application in a headless manner another security setup could probably be beneficial.
More information on how to configure the Identity module can be found here:
https://piranhacms.org/docs/architecture/authentication/identity
Another option is to just provide your own Api instead of using the Piranha.WebApi
package. If you take a look at the code for the Api-package here you can see that there's absolutely no logic in these endpoints, they just call the registered Piranha.IApi
object.
https://github.com/PiranhaCMS/piranha.core/blob/master/core/Piranha.WebApi/PageApiController.cs#L45
Best regards
Håkan
QUESTION
This question is difficult to word in the title, so an example is required:
I have 3 lists:
...ANSWER
Answered 2019-Nov-21 at 16:12itertools.product is used for this.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install piranha
Install Python 3
Clone the Piranha repository
Open project/piranha.sln in Microsoft Visual Studio
Right click on piranha_reference_compiler and select 'Set as StartUp Project'
Run the application
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page