Python 3.12.3 and 3.13.0a6 released

It’s time to eclipse the Python 3.11.9 release with two releases, one of which is the very last alpha release of Python 3.13:

 

Python 3.12.3

300+ of the finest commits went into this latest maintenance release
of the latest Python version, the most stablest, securest, bugfreeest we
could make it.

Python 3.13.0a6

What’s that? The last alpha release? Just one more month until
feature freeze! Get your features done, get your bugs fixed, let’s get
3.13.0 ready for people to actually use! Until then, let’s test with
alpha 6. The highlights of 3.13 you ask? Well:

(Hey, fellow core developer, if a feature you find important is missing from this list, let Thomas know. It’s getting to be really important now!)

We hope you enjoy the new releases!

Thanks to all of the many volunteers who help make Python Development
and these releases possible! Please consider supporting our efforts by
volunteering yourself, or through contributions to the Python Software Foundation or CPython itself.

Thomas “can you tell I haven’t had coffee today” Wouters
on behalf of your release team,

Ned Deily
Steve Dower
Pablo Galindo Salgado
Łukasz Langa

iXsystems: focusing on Linux makes more sense than FreeBSD

A few weeks ago we talked about how iXsystems, the company behind TrueNAS CORE and SCALE, has all but confirmed that its FreeBSD-based CORE product will be put in maintenance mode, while the Linux-based SCALE product will get all the attention and focus from here on out. In an interview with Blocks & Files, the company gave more insight into this choice. “We had a huge chunk of our engineering staff spending time improving FreeBSD as opposed to working on features and functionalities. What’s happened now with the transition to having a Debian basis, the people I used to have 90 percent of their time working on FreeBSD, they’re working on ZFS features now … That’s what I want to see; value add for everybody versus sitting around, implementing something Linux had a years ago. And trying to maintain or backport, or just deal with something that you just didn’t get out of box on FreeBSD.” “It’s not knocking against FreeBSD. We love it. That’s our heritage. That’s our roots, I was on the CORE team elected twice. So believe me, if I felt like I could have stayed on FreeBSD for the next 20 years, I would have absolutely preferred to do that … But at some point, you gotta read the writing on the wall and say, well, all the the vendor supported-innovations are happening on the Linux side these days.” BSD aficionados don’t like this change. Moore said: “Talk is cheap and complaints are free. You know, everyone loves to complain about it. But … if people wanted to push FreeBSD forward for the last 15 years, they would have.” ↫ Chris Mellor at Blocks & Files Above all else, my personal north star is choice, especially in technology, and as such, I want iXsystems to keep focusing on FreeBSD so that not everyone is using Linux for server- and server-like workloads. The fact that TrueNAS was a FreeBSD-based product for this long was amazing, and I would definitely have preferred if it stayed that way for many, many more years to come. However, I don’t think the people of TrueNAS are saying anything wrong or outrageous here. They’ve got employees to feed, and the money is in Linux, not FreeBSD. If they spend more money, time, and resources on getting FreeBSD on par with features Linux has had for ages than on actually developing their own product – TrueNAS – then they’re fighting a losing battle. Honestly, I’m surprised it’s taken them this long to take this controversial step. All we can hope for is that the things they work on, the features they develop, will make it to FreeBSD regardless.

Specbee: How to create custom tokens in Drupal

It’s stuff like these that make Drupal not just powerful, but also highly customizable and user-friendly. What are we talking about? Tokens! It’s one of the most versatile and super handy Drupal modules.​​ Sometimes, users need to establish a specific pattern to programmatically retrieve values. In these instances, tokens come to the rescue, providing a seamless solution. Read on to find out more about tokens and how you can create custom tokens for your Drupal website.

What are Tokens
Tokens in Drupal are primarily used for dynamically inserting data into content, such as user information, node details, or site settings. They make content more personalized and automated without manual intervention, streamlining the editing process and enhancing user experiences. For example, they can be used while sending emails during webform submissions or content moderation.
Before creating custom tokens you need to have the Drupal tokens module installed on your Drupal site. This contributed module already comes with some predefined tokens. These defined tokens can be used globally.

Steps to Create Custom Tokens
Step 1: Create a custom moduleTo create a custom token in Drupal, we either need to develop a new custom module or incorporate it into an existing one. For example, let’s name the module “Custom Token,” and the corresponding directory would be named “custom_token.” After creating this folder, we should generate a “custom_token.info.yml” file, where we’ll specify the module details.
name: Custom token
type: module
description: Provides custom tokens.
package: tokens
core_version_requirement: ^10Step 2: Clear the cacheAfter adding this code, clear the cache and refresh the page to apply the changes. Next, search for the custom token module and install it.

Step 3: Create the custom tokenOnce the module is installed, create a file named “custom_token.tokens.inc” within the folder. Inside this file, we’ll define the custom tokens. In the given scenario, there’s a webform for reviewing article content, and a link to this webform is added to the detailed page of articles. Now, the URL to the webform appears as follows:‘webform/contact_new/test?article=1’. The article field is also auto-filled based on the token.

Here, the article author is a hidden field that should auto-fill after form submission. Additionally, the article author is a field within the article content type. To dynamically retrieve this data, we need to create a custom token.
The code that will be added inside the “tokens.inc” file is provided below.
<?php
/**
* @file
* File to add custom token.
*/
use DrupalCoreRenderBubbleableMetadata;
/**
* Implements hook_token_info().
*/
function custom_token_token_info() {
  $types[‘article’] = [
    ‘name’ => t(‘Custom token’),
    ‘description’ => t(‘Define custom tokens.’),
  ];
  $tokens[‘article_title’] = [
    ‘name’ => t(‘Article title’),
    ‘description’ => t(‘Token to get current article title.’),
  ];
  $tokens[‘article_author’] = [
    ‘name’ => t(‘Article author’),
    ‘description’ => t(‘Token to get current article author.’),
  ];
  return [
    ‘types’ => $types,
    ‘tokens’ => [‘article’ => $tokens],
  ];
}
/**
* Implements hook_tokens().
*/
function custom_token_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
  $replacements = [];
  if ($type == ‘article’) {
    $nid = Drupal::request()->query->get(‘article’);
    if ($nid) {
      $node_details = Drupal::entityTypeManager()->getStorage(‘node’)->load($nid);
    }
    foreach ($tokens as $name => $original) {
      // Find the desired token by name.
      switch ($name) {
        case ‘article_author’:
          if ($node_details) {
            $user_id = $node_details->field_author->target_id;
            if ($user_id) {
              $user_details = Drupal::entityTypeManager()->getStorage(‘user’)->load($user_id);
              $replacements[$original] = $user_details->name->value;
            }
          }
          break;
          case ‘article_title’:
          if ($node_details) {
            $replacements[$original] = $node_details->label();
          }
          break;
      }
    }
  }
  return $replacements;
}And this is how we can craft custom tokens to suit our specific needs. Once implemented, the webform results will seamlessly display the auto-filled value.

Final Thoughts
Drupal’s power lies not just in its functionality, but in its adaptability and ease of use. Tokens are an example of this versatility, since they offer a way to dynamically retrieve data as well as personalize content. Tokens streamline processes and improve user experience, whether they are used for user information, node details, or site settings.