Dear All,

I am afraid I need a wee bit more help here, which is entirely related to 
my limited experience with Django. Apologies.
Here is what I would like to do:
Imagine you have documents uploaded into Mayan EDMS that expire after a 
given period of time, such as warranty documents.
So, I should be able to create a metadata set, that contains both the date 
the documents gets uploaded into an "valid" folder, and and automatically 
completed expiry metatdata field which, in Python speak, would do something 
like as a minimum:

from datetime import timedelta
VALIDITY_PERIOD = 365 
expiry_date = date_of_purchase + timedelta(days=VALIDITY_PERIOD)
In the stanza above, expiry_date should be calculated from another metadata 
field called, for instance date_of_purchase. How can this be achieved (for 
dummies!) in Mayan EDMS?
I guess once I have a worknig example on how to include Python functions in 
detail, I can easily do other things.
Thanks a million!
Chris



On Wednesday, 10 September 2014 16:26:09 UTC+3, Gary D Walborn wrote:
>
> Roberto,
>
>   Thanks.  I should have mentioned that I figured that out the other day 
> by looking at the source code.   Be aware that the current code does not 
> override "__builtins__", so it is possible to enter code in the LOOKUP area 
> to do anything that you want.  For example,
>
> __import__('my_custom_module').my_function()
>
> I think that is probably not intended, but it works.
>
> Gary W. 
>
> On Tuesday, September 9, 2014 2:22:12 PM UTC-4, Roberto Rosario wrote:
>>
>> Create you own custom settings.py file in mayan/settings directory:
>>
>> # my_settings.py file
>> from my_custom_module import my_function
>>
>> METADATA_AVAILABLE_MODELS = {'my_function': my_function}
>>
>> and launch Mayan with --settings=mayan.settings.my_settings.py
>>
>> now my_function should be available in the namespace of your metadata 
>> lookup snippets.
>>
>>
>> On Tuesday, September 9, 2014 8:59:02 AM UTC-4, Gary D Walborn wrote:
>>>
>>> I found a work-around for this, but I think it is also a huge security 
>>> hole in Mayan-EDMS.  I think I'll use it, but it will probably go away when 
>>> (if) the security hole is fixed. :-(  
>>>
>>> On Thursday, September 4, 2014 3:48:38 PM UTC-4, Gary D Walborn wrote:
>>>>
>>>> I have written a python function (lets call it 'options') that returns 
>>>> a list of strings.  I would like to use this function to populate the 
>>>> drop-down lists in a metadata type.  I have tried all sorts of ways to do 
>>>> this, and none of them seem to work.  The documentation is very scant on 
>>>> this subject.  Can anyone provide any information on how this is supposed 
>>>> to work?
>>>>
>>>> Thanks,
>>>>
>>>> Gary Walborn
>>>>
>>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to