I have the following typoscript
[PIDinRootline=6,7,11]
//do somehting
[end]
[PIDinRootline=6,7,11] && [globalVar = TSFE:id=1]
// do something else
[global]
I only get the result from [PIDinRootline=6,7,11]. My && condition is not working here. What I'm doing wrong?
Solution:
I think it was late and I only copy and pasted the code. What I wanted to do is to query on a certain page ID and a certain language. This is the solution:
[PIDinRootline=6,7,11]
//do somehting
[end]
[PIDinRootline=6,7,11] AND [globalVar = GP:L=1]
// do something else
[end]
[globalVar = TSFE:id=1] means: Exactly on this page. Therefore you might need to use OR because both conditions cannot be met at the same time, when assuming that PID 1 is above 6, 7 and 11, like in this page tree example:
1 ---
- 5 -
- 6 -
- 7 -
- 9 -
- 11-
2 ---
- 3 -
- 4 -
Also, you can use the typoscript object browser in the Template module to debug typoscript. More options described here.
You have just mispell the command its written AND and not ยจ&&". Didn't it throw an error in the TS-Parser? You can look at the rendering process from the website in the administartion panel.
Related
I just started to use Karate Gatling for performance tests and facing following problem:
I have a call for the search and would like to evaluate different types of search depending on the parameter e.G. https://example.com/search/facetedSearch
'*'
'keyword1'
'keyword1, keyword2' etc.
The feature file looks something like this:
#performance
Feature: Search
Background:
* url 'https://example.com/'
Scenario Outline: Search -> Simple search for a single word
Given path '/search/facetedSearch'
And param facetedSearchAdditionalFilter[searchAreaID] = -1
And param facetedSearchAdditionalFilter[searchKey] = '<SearchTermSimple>'
When method post
Then status 200
And assert iNumHits >= iNumHitsExpected
Examples:
| read('../testData/performanceTestData.csv') |
Scenario: Search -> Simple search for *
Given path '/search/facetedSearch'
And param facetedSearchAdditionalFilter[searchAreaID] = -1
And param facetedSearchAdditionalFilter[searchKey] = '*'
When method post
Then status 200
And assert iNumHits >= iNumHitsExpected
Scenario Outline: Search -> Search for multiple words
Given path '/search/facetedSearch'
And param facetedSearchAdditionalFilter[searchAreaID] = -1
And param facetedSearchAdditionalFilter[searchKey] = '<SearchTermMultiple>'
When method post
Then status 200
And assert iNumHits >= iNumHitsExpected
Examples:
| read('../testData/performanceTestData.csv') |
I would like to evaluate different types of search separately, as the performance is significantly different. What gatling does - it aggregates all different types of search in one result - "POST /search/facetedSearch".
Is there a possibility to let evaluate every type of search individually in one run?
Thanks in advance,
Sergej
Yes, refer the docs on using a custom nameResolver: https://github.com/karatelabs/karate/tree/master/karate-gatling#nameresolver
For your case you should be able to call req.getParam("facetedSearchAdditionalFilter[searchKey]")[0] or something similar. Or you could choose to use an additional header.
I have a response with hundreds of attributes while matching the attributes the scripts getting failed and further steps are not getting executed. because of this we have to validate the same case multiple times to validate the attribute values. is they a option like #ContinueNextStepsOnException to execute all the steps and it is hard to script using karate.match(actual, expected) for more than 100 attributes I have give actual and expected values if in case of any failure to continue.
No, there is no such option. If your scripts are getting failed - it is because Karate is doing its job correctly !
If you feel you want to skip certain fields, you can easily do so by using match ... contains syntax.
I think you are using multiple lines instead of matching the entire JSON in one-line which you can easily do in Karate. For example:
* def response = { a: 1, b: 2 }
# not recommended
* match response.a == 1
* match response.b == 2
# recommended
* match response == { a: 1, b: 2 }
Is it so hard to create the above match, even in development mode ? Just cut and paste valid JSON, and you are done ! I have hardly ever heard users complain about this.
after managing to add modules to Moodle programmaticaly (see my old question here) I now also need to add the module at a specific place.
Lets take for example a sample course in Moodle, I have:
Section 0
- Module 1
- --> ADD NEW MODULE HERE <--
- Module 2
Section 1
- Module 1
- Module 2
Section 2
So I need to add the new module I create programatically inbetween module 1 and 2 of section 0.
I know that the order of modules come from table mdl_course_sections and its specified in the column sequence where the ids of the modules exist in comma separated values
Is there a function in Moodle that does that? Set the sequence of a section? I don't want to mess with the DB directly.
After I got some help from Moodle community (thanks Sam Chaffee) here is the solution
//...Do stuff to create module object...
// ...
$moduleinfo = add_moduleinfo($newlabel, $section);
//lets get all sections and modules of the course
$coursemodinfo = get_fast_modinfo($course->id, 0, false);
//get all sections of the course
$coursesections = $coursemodinfo->get_sections();
//get the first section, get_section will return an array of sections so I get position 0 to get section 1
$section01 = $coursesections[0];
//get the first module in the section so we can add on top of it
$firstmodid = $section01[0];
//We need to get cm_info for the specific mod
$mod = $coursemodinfo->get_cm($moduleinfo->coursemodule);
//we also need section_info for the section we want to move to
$sectioninfo = $coursemodinfo->get_section_info(0);
//move the newly created module to section 01 but before $firstmodid
moveto_module($mod, $sectioninfo, $firstmodid);
I have a crawler that works just fine in collecting the urls I am interested in. However, before retrieving the content of these urls (i.e. the ones that satisfy rule no 3), I would like to update them, i.e. add a suffix - say '/fullspecs' - on the right-hand side. That means that, in fact, I would like to retrieve and further process - through callback function - only the updated ones. How can I do that?
rules = (
Rule(LinkExtractor(allow=('something1'))),
Rule(LinkExtractor(allow=('something2'))),
Rule(LinkExtractor(allow=('something3'), deny=('something4', 'something5')), callback='parse_archive'),
)
You can set process_value parameter to lambda x: x+'/fullspecs' or to a function if you want to do something more complex.
You'd end up with:
Rule(LinkExtractor(allow=('something3'), deny=('something4', 'something5')),
callback='parse_archive', process_value=lambda x: x+'/fullspecs')
See more at: http://doc.scrapy.org/en/latest/topics/link-extractors.html#basesgmllinkextractor
I'm trying to use yaml to represent a train network with stations and lines; a minimum working example might be 3 stations, connected linearly, so A<->B<->C. I represent the three stations as follows:
---
stations:
- A
- B
- C
Now I want to store the different lines on the network, and where they start/end. To do this, I add a lines array and some anchors, as follows:
---
stations:
- &S-A A
- &S-B B
- &S-C C
lines:
- &L-A2C A to C:
from: *S-A
to: *S-C
- &L-C2A C to A:
from: *S-C
to: *S-A
and here's the part I'm having trouble with: I want to store the next stop each line at each station. Ideally something like this:
---
stations:
- &S-A A:
next:
- *L-A2C: *S-B
- &S-B B:
next:
- *L-A2C: *S-C
- *L-C2A: *S-A
- &S-C C:
next:
- *L-C2A: *S-B
(the lines array remains the same)
But this fails - at least in the Python yaml library, saying yaml.composer.ComposerError: found undefined alias 'L-A2C'. I know why this is - it's because I haven't defined the line yet. But I can't define the lines first, because they depend on the stations, but now the stations depend on the lines.
Is there a better way to implement this?
Congradulations! You found an issue in most (if not all) YAML implementations. I recently discovered this limitation too and I am investigating how to work around (in Ruby world). But that's not going to help you. What you are going to have to do is store the "next stops" as a separate set of data points.
next-stops:
*S-A:
- *L-A2C: *S-B
*S-B:
- *L-A2C: *S-C
- *L-C2A: *S-A
*S-C:
- *L-C2A: *S-B
Does that help?