mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) New type conversion in the backend
Summary: This is https://phab.getgrist.com/D3205 plus some changes (https://github.com/dsagal/grist/compare/type-convert...type-convert-server?expand=1) that move the conversion process to the backend. A new user action ConvertFromColumn uses `call_external` so that the data engine can delegate back to ActiveDoc. Code for creating formatters and parsers is significantly refactored so that most of the logic is in `common` and can be used in different ways. Test Plan: The original diff adds plenty of tests. Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3240
This commit is contained in:
@@ -500,6 +500,14 @@ def N(value):
|
||||
return 0
|
||||
|
||||
|
||||
def CURRENT_CONVERSION(rec):
|
||||
"""
|
||||
Special function used only when changing the type of a column.
|
||||
Doesn't work in normal formulas.
|
||||
"""
|
||||
return rec.gristHelper_Converted
|
||||
|
||||
|
||||
def NA():
|
||||
"""
|
||||
Returns the "value not available" error, `#N/A`.
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
from datetime import datetime, timedelta
|
||||
import re
|
||||
from .date import DATEADD, NOW, DTIME
|
||||
from moment_parse import MONTH_NAMES, DAY_NAMES
|
||||
|
||||
# Limit exports to schedule, so that upper-case constants like MONTH_NAMES, DAY_NAMES don't end up
|
||||
# exposed as if Excel-style functions (or break docs generation).
|
||||
__all__ = ['SCHEDULE']
|
||||
|
||||
MONTH_NAMES = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august',
|
||||
'september', 'october', 'november', 'december']
|
||||
# Regex list of lowercase weekdays with characters after the first three made optional
|
||||
DAY_NAMES = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
|
||||
|
||||
def SCHEDULE(schedule, start=None, count=10, end=None):
|
||||
"""
|
||||
Returns the list of `datetime` objects generated according to the `schedule` string. Starts at
|
||||
|
||||
Reference in New Issue
Block a user