Most Powerful Open Source ERP

Technical Note Url Generation

Technical Note on how URLs should be generated in ERP5.
  • Last Update:2016-08-23
  • Version:001
  • Language:en

This technical note defines the patterns for how URLs should be generated in ERP5

Table of Contents

  • Related Articles

    URL always needs an action name or method name

    Because of string operations on URLs, ERP5 must always append an action name or a method name in every URL. For instance, when ERP5 gets a URL string "/erp5/person_module/view" and traverse an object, ERP5 needs to use this kind of statement:

    
    path = url.split('/')[:-1] # path == ['erp5', 'person_module']
    

    If you pass "/erp5/person_module" which shows up the same interface instead, the statement fails:

    
    path = url.split('/')[:-1] # path == ['erp5']
    

    Generally, this does not happen frequently, but not easy to fix at the same time. So when you make an URL, you must make sure that the URL ends with a method name instead of an object name. Note that you may not omit a method name if it is something else than view, thus it is better to stick to appending a method name all the time, if you have to select including a method name or not.

    Related Articles